有时fputs()或fwrite()编码html特殊字符? [英] Does sometime fputs() or fwrite() encode html special characters?
问题描述
我输出一个包含html内容的字符串到html文件,但在html文件中,html特殊字符被编码(例如 $ c $在
\& quot;
在使用写函数之前使用htmlspecialcharacters_decode,wierd部分是在我的计算机上的字符没有编码,而上传到某些服务器上编码,我如何处理这个问题?
I am outputting a string that consists of html content to a html file, but in the html file the html special characters are encoded (for example "
in \"
). I've even used htmlspecialcharacters_decode before using the write functions. The wierd part is that on my computer the characters are not encoded, while uploaded on some server are encoded. How can I deal with this problem?
预期的感谢!
推荐答案
您可能患有 Magic Quotes
检查您的phpinfo();
Check you phpinfo();
要清除Magic Quotes,请查看php.net上的讨论:
http://www.php.net/manual/en/function.stripslashes.php
To clear Magic Quotes look into the discussion at php.net: http://www.php.net/manual/en/function.stripslashes.php
示例(c )jeremysawesome:
Example (c) jeremysawesome:
array_walk_recursive($_POST, create_function('&$val', '$val = stripslashes($val);'));
这篇关于有时fputs()或fwrite()编码html特殊字符?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!