Home > Backend Development > PHP Tutorial > php戏法引用

php戏法引用

WBOY
Release: 2016-06-13 12:56:35
Original
890 people have browsed it

php魔术引用

????????前段时间迁移系统的时候,发现一个诡异的问题,每当保存一个form里的数据时,凡是数据中有双引号的都默认转义为\"。找了大半天还没定位到原因,一直认为是系统编码有问题导致的。还是万能的百度拯救了我,经过搜索后才知道,php在apache服务器中有一个设置专门处理这种情况。

??????

??????? 出于安全的考虑,默认的情况下apache服务器会将双引号转义,只要设置magic_quotes_gpc为关闭状态,上述的问题得以解决。或者可以在程序中判断magic_quotes_gpc是否打开,如果打开,则使用stripslashes进行反转义,当然调用这方法会损耗一定的性能。

?

mark下:

apache配置:magic_quotes_gpc = off;

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