php PDO Chinese garbled solution_PHP tutorial

WBOY
Release: 2016-07-21 15:45:48
Original
986 people have browsed it

// Method 1:
PDO::__construct($dsn, $user, $pass, array(PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES 'utf8';"));

// Method 2:
PDO::__construct($dsn, $user, $pass);
PDO::exec("SET NAMES 'utf8';");

Both methods can be used To solve the problem, the principle is the same, whichever one you use depends on your preference

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/320275.htmlTechArticle// Method 1: PDO::__construct($dsn, $user, $pass, array(PDO:: MYSQL_ATTR_INIT_COMMAND = "SET NAMES 'utf8';")); // Method 2: PDO::__construct($dsn, $user, $pass); PDO::exec("SET NAM...
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
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!