THINKPHP3 Query MSSQL Database garbled solution _php Tutorial

Source: Internet
Author: User
Tags mssql
This article mainly introduces the THINKPHP3 query MSSQL database garbled solution, the need for friends can refer to the next

thinkphp Query MSSQL Database garbled reason is thinkphp default is UTF-8, and Msmsql database is Simplified Chinese version, stored is GB2312 encoding solution: 1: In Thinkphp\lib\core Open Db.class.php, add 2 at the end of it: Find function Select () in Db.class.php, $result = $this->query ($sql), followed by a $result =iconv2utf8 ($result), OK The code is as follows: Public function Iconv2utf8 ($Result) {$Row =array (); $key 1=array_keys ($Result);//Fetch query Results $ The key value of the array of result//print_r ($key 1); $key 2=array_keys ($Result [$key 1[0]]); The key value//print_r ($key 2) of the first array ($key 1[0]) of the query result $result is taken; for ($i =0; $i

http://www.bkjia.com/phpjc/733181.html www.bkjia.com true http://www.bkjia.com/phpjc/733181.html techarticle This article mainly introduces the THINKPHP3 query MSSQL database garbled solution method, the need for friends can refer to the next thinkphp Query MSSQL Database garbled reason is thinkphp default to UTF-8, ...

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.