Home > Article > Backend Development > Solution to garbled characters in php query mssql_PHP tutorial
The specific analysis is as follows:
When php connects to mssql, all the results are garbled. I know from experience that this problem is an encoding problem. Let me summarize the solution for you.
Method one, modify the php.ini file. Of course, it can be set to UTF-8 encoding according to the situation of your page. The code is as follows:
The code is as follows:
mssql.charset = "GBK"
Method 2, convert directly in the program, the code is as follows:
The code is as follows:
Method three, use Ado connection to set the encoding when connecting, the code is as follows:
The code is as follows:
PHP example, the code is as follows:
The code is as follows: