The reason why thinkphp displays garbled characters when querying the mssql database is that ThinkPHP defaults to UTF-8, while the msmsql database is a simplified Chinese version and stores GB2312 encoding
Solution:
1: Open Db.class.php in ThinkPHPLibCore and add
2: Find function select() in Db.class.php, in $result = $this->query($sql ); add $result=iconv2utf8($result) after it, and it’s OK
Copy code The code is as follows:
public function iconv2utf8($Result) {
$key1=array_keys($Result); //Get the key value of the array of query result $Result ]]);
//Get the key value of the first array ($key1[0]) of the query result $Result
//print_r($key2); $i
for($j=0;$j
http://www.bkjia.com/PHPjc/733057.html
www.bkjia.com
true
http: //www.bkjia.com/PHPjc/733057.html
TechArticleThe reason why thinkphp queries mssql database with garbled characters is that ThinkPHP defaults to UTF-8, and the msmsql database is the simplified Chinese version. The storage is GB2312 encoding solution: 1: In ThinkPHPLibCor...