Thinkphp3 query mssql database garbled solution_PHP tutorial

WBOY
Release: 2016-07-13 10:39:06
Original
903 people have browsed it

This article mainly introduces the solution to garbled characters in thinkphp3 query mssql database. Friends in need can refer to it

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 at the end 2: Find function select() in Db.class.php, add $result=iconv2utf8($result) after $result = $this->query($sql);, and it’s OK ​ The code is as follows: public function iconv2utf8($Result) { $Row=array(); $key1=array_keys($Result); //Get the key value of the array of query result $Result //print_r($key1); $key2=array_keys($Result[$key1[0]]); //Get the key value of the first array ($key1[0]) of the query result $Result //print_r($key2);               for($i=0;$i

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/733181.htmlTechArticleThis article mainly introduces the solution to garbled characters in thinkphp3 query mssql database. Friends in need can refer to thinkphp query mssql database. The reason for the garbled characters is that ThinkPHP defaults to UTF-8,...
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template