Home  >  Article  >  php教程  >  php奇葩错误:htmlspecialchars处理中文丢失

php奇葩错误:htmlspecialchars处理中文丢失

WBOY
WBOYOriginal
2016-06-13 11:32:011272browse

<span $value</span> = "中文中文"<span ;
</span><span $res</span> = <span htmlspecialchars</span>(<span $value</span>);

经过这个函数处理之后,$res就直接变成了空的字符串。

 

奇葩错误啊!后来发现要这样才能成功,以前都没遇到过呢,奇怪!

<span htmlspecialchars</span>(<span $value</span>, ENT_NOQUOTES, "gb2312");

这样处理就OK,不明觉厉,不明觉厉……

 

BY THE WAY:PHP VERSION:5.3.10

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
Previous article:Linux php 中文乱码解决Next article:php批量POST修改