php自动转义

WBOY
WBOYOriginal
2016-06-23 14:30:401101browse

php.ini中有两个先选控制自动转义

magic_quotes_gpc:自动转义GET/POST/COOKIES magic_quotes_runtime:自动转义SQL

今天在使用json_decode时发现上面的问题,应为将json中的所有双引号添加了斜线"\"

默认这两个选项为"On",设置"Off"将其关闭,如果不想修改配置,可以使用stripcslashes将自动转义的字符串再反转义回来。

 

参考

http://www.cnblogs.com/66feifei/archive/2008/05/06/1185408.html

http://hi.baidu.com/lovelyapple/blog/item/292133c7d58fd8cbd00060d3.html

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:PHP安全编程Next article:php上传文件