Home > php教程 > php手册 > body text

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

WBOY
Release: 2016-06-13 11:32:01
Original
1275 people have browsed it

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

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

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

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

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

 

BY THE WAY:PHP VERSION:5.3.10

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 Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template