This article mainly introduces the THINKPHP3 query MSSQL database garbled solution, the need for friends can refer to the following
thinkphp Query MSSQL database appears garbled reason is thinkphp default for UTF-8, and Msmsql database is Simplified Chinese version, storage is GB2312 coding Solution: 1: In Thinkphplibcore Open the Db.class.php and add 2 at the end: Db.class.php to find the function select (), in $result = $this->query ($sql), followed by a $result =iconv2utf8 ($result), OK Code as follows: Public function Iconv2utf8 ($Result) { $Row =array (); & nbsp $key 1=array_keys ($Result); //$result The value of the array of query results //print_r ($key 1); $key 2=array_keys ($Result [$key 1[0]]); //Query Results $result the first array ($key 1[0]) of the key value //print_r ($key 2); for ($i =0 $i <count ($key 1) $i + +) { &NB Sp For ($j =0 $j <count ($key 2); $j + +) { &N Bsp //query result encoding to utf-8, and deposited in $row, and $row with $result key and value consistent $Ro w[$key 1[$i]][$key 2[$j]]=iconv (' gb2312 ', ' utf-8 ', $Result [$key 1[$i]][$key 2[$j]]); }   retrun $Row; }