Home > Backend Development > PHP Tutorial > php PDO Chinese garbled solution_PHP tutorial

php PDO Chinese garbled solution_PHP tutorial

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-07-21 15:45:48
Original
1063 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...
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
Latest Issues
php data acquisition?
From 1970-01-01 08:00:00
0
0
0
PHP extension intl
From 1970-01-01 08:00:00
0
0
0
How to learn php well
From 1970-01-01 08:00:00
0
0
0
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template