exec('SET NAMES utf8');。 编码基本一致,查询如id=5时正常返回中文数据。 使用$sql="SELECT * FROM table WHERE name LIKE '%$中文%'";没有返回结果。。。。求"/> exec('SET NAMES utf8');。 编码基本一致,查询如id=5时正常返回中文数据。 使用$sql="SELECT * FROM table WHERE name LIKE '%$中文%'";没有返回结果。。。。求">

Home  >  Article  >  Backend Development  >  数据库-编码一致,php查询中文时无返回结果

数据库-编码一致,php查询中文时无返回结果

WBOY
WBOYOriginal
2016-06-02 11:28:00945browse

php数据库

PHP文件补充了header("Content-Type:text/html;charset=utf-8");,数据库是UTF-8编码,查询字段也是UTF-8,php中PDO查询时也$pdo->exec('SET NAMES utf8');。
编码基本一致,查询如id=5时正常返回中文数据。
使用$sql="SELECT * FROM table WHERE name LIKE '%$中文%'";没有返回结果。。。。求大神帮帮忙。

Statement:
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