magic_quotes_gpc 、 magic_quotes_runtime 、 magic_quotes_sybase 介绍

1、三个配置项的做用与区别php

magic_quotes_gpchtml

做用:对php服务器端接收的 GET POST COOKIE 的值执行 addslashes() 操做。
做用范围是:WEB客户服务端。
做用时间:请求开始时,例如当脚本运行时。

magic_quotes_runtimesql

做用:对经过 fread()、file_get_contents() 返回的文本执行 addslashes() 操做,对执行sql查询的结果执行 addslashes() 操做。
做用范围:从文件中读取的数据或执行 exec() 的结果或是从SQL查询中获得的。
做用时间:每次当脚本访问运行状态中产生的数据。

magic_quotes_sybase数据库

做用:影响 addslashes() 函数。
magic_quotes_sybase=0 时,addslashes 将对 ' " \ 进行 \ 转义操做;
magic_quotes_sybase=1 时,addslashes 将对 ' 进行 '' 转义操做(两个单引号)。服务器


总结:
magic_quotes_gpc 的设定值将会影响经过 Get/Post/Cookies 得到的数据。
magic_quotes_runtime 的设定值将会影响从文件中读取的数据或从数据库获得的数据。函数

 

2、相关函数spa

get_magic_quotes_gpc().net

查看 magic_quotes_gpc 值。0=关闭,1=打开。PHP5.4时,始终返回 FALSE,由于这个魔术引号功能已经从 PHP 中移除了。

get_magic_quotes_runtime()htm

查看 magic_quotes_runtime 值。0=关闭,1=打开。

set_magic_quotes_runtime()blog

设置 magic_quotes_runtime 值。0=关闭,1=打开。默认状态是关闭的。能够经过 echo phpinfo(); 查看magic_quotes_runtime

没有 set_magic_quotes_gpc() 这个函数

就是不能在程序里面设置 magic_quotes_gpc 的值。

addslashes($data)

在指定的预约义字符前添加反斜杠。
预约义字符包括: 单引号'、双引号"、反斜线\ 、NULL。

stripslashes($data)

删除由 addslashes() 函数添加的反斜杠。

 

转载:http://www.cnblogs.com/liukai1501/archive/2013/04/09/3010778.html        http://blog.csdn.net/zmouki/article/details/4211402

相关文章
相关标签/搜索