Home > Backend Development > PHP Tutorial > Solution to php pdo encoding garbled problem

Solution to php pdo encoding garbled problem

WBOY
Release: 2016-07-25 08:54:42
Original
1080 people have browsed it
  1. mysql_query(“set names utf8″);
Copy code

So, use the same method as above. Solve the problem of Chinese garbled characters in pdo.

  1. $db = new PDO($dbconn['dns'],$dbconn['dbuser'],$dbconn['dbpwd']);
  2. $db->query("set names utf8″ );
Copy the code

In this way, the pdo encoding problem is solved.

Summary: PHP Chinese garbled problems, PDO Chinese garbled problems, MySQL Chinese garbled problems, etc., all of them basically did not support Chinese at the beginning. In the future, when Chinese becomes more powerful, we can develop a Chinese programming tool. For example: if (1==1) { implement. . . }



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