Does sometime fputs() or fwrite() encode html special characters?

[亡魂溺海] 提交于 2019-12-13 03:43:45

问题


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?

Anticipated thanks!


回答1:


You are probably suffering from Magic Quotes

Check you phpinfo();

To clear Magic Quotes look into the discussion at php.net: http://www.php.net/manual/en/function.stripslashes.php

Example (c) jeremysawesome:

array_walk_recursive($_POST, create_function('&$val', '$val = stripslashes($val);'));


来源:https://stackoverflow.com/questions/10199223/does-sometime-fputs-or-fwrite-encode-html-special-characters

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!