magic_quotes_gpc和magic_quotes_runtime
2010-04-19 10:19
232 查看
以前我写php的没有多想这个魔术引用的问题
最近不是挺忙就研究了一下,没有想到设置魔术引用的还有两个了呢
magic_quotes_gpc是设置Get、Post、Cookies的,此设置为on是客户端提交过来的数据会自动转义的,这个转义是用来操作数据库时使用的,如果你用来显示的化还是要去掉这转义的,不然显示就多个反斜杠了
magic_quotes_gpc是不能在php运行中设置的。
magic_quotes_runtime的设定值将会影响从文件中读取的数据或从数据库查询得到的数据
这个我今天还特意的测试了一下呢代码如下
echo get_magic_quotes_runtime().'<br>';
echo readfile("test5.php");
set_magic_quotes_runtime(true);
echo get_magic_quotes_runtime().'<br>';
echo readfile("test5.php")
test5.php文件内容如下 'jsdflsf//ffff'
显示内容如下
0
'jsdflsf//ffff'
171
'jsdflsf//ffff' 17
靠竟然没有什么用啊,真是奇怪了。我代码调整了好几次也没有什么变化啊。
没有想到什么好的办法,那就换个读取文件的方法了
又测试了如下
echo get_magic_quotes_runtime().'<br>';
echo file_get_contents("test5.php");
set_magic_quotes_runtime(true);
echo get_magic_quotes_runtime().'<br>';
echo file_get_contents("test5.php")
显示内容如下
0
'jsdflsf//ffff'
1
/'jsdflsf////ffff/'
总算是有用了,看来是这个set_magic_quotes_runtime对readfile是没有用的
最近不是挺忙就研究了一下,没有想到设置魔术引用的还有两个了呢
magic_quotes_gpc是设置Get、Post、Cookies的,此设置为on是客户端提交过来的数据会自动转义的,这个转义是用来操作数据库时使用的,如果你用来显示的化还是要去掉这转义的,不然显示就多个反斜杠了
magic_quotes_gpc是不能在php运行中设置的。
magic_quotes_runtime的设定值将会影响从文件中读取的数据或从数据库查询得到的数据
这个我今天还特意的测试了一下呢代码如下
echo get_magic_quotes_runtime().'<br>';
echo readfile("test5.php");
set_magic_quotes_runtime(true);
echo get_magic_quotes_runtime().'<br>';
echo readfile("test5.php")
test5.php文件内容如下 'jsdflsf//ffff'
显示内容如下
0
'jsdflsf//ffff'
171
'jsdflsf//ffff' 17
靠竟然没有什么用啊,真是奇怪了。我代码调整了好几次也没有什么变化啊。
没有想到什么好的办法,那就换个读取文件的方法了
又测试了如下
echo get_magic_quotes_runtime().'<br>';
echo file_get_contents("test5.php");
set_magic_quotes_runtime(true);
echo get_magic_quotes_runtime().'<br>';
echo file_get_contents("test5.php")
显示内容如下
0
'jsdflsf//ffff'
1
/'jsdflsf////ffff/'
总算是有用了,看来是这个set_magic_quotes_runtime对readfile是没有用的
相关文章推荐
- magic_quotes_gpc与magic_quotes_runtime区别
- magic_quotes_gpc 、 magic_quotes_runtime 、 magic_quotes_sybase 介绍
- php中get_magic_quotes_gpc和get_magic_quotes_runtime 字符转义
- PHP中magic_quotes_gpc和 magic_quotes_runtime区别及其反斜线转义问题
- PHP中set_magic_quotes_runtime()和get_magic_quotes_gpc()
- PHP中magic_quotes_gpc和 magic_quotes_runtime区别
- PHP 中 magic_quotes_gpc 和 magic_quotes_runtime 的区别,作用和用法
- PHP 中 magic_quotes_gpc 和 magic_quotes_runtime 的区别,作用和用法
- 魔法引用函数magic_quotes_gpc和magic_quotes_runtime的区别和用法
- magic_quotes_gpc和magic_quotes_runtime的区别和用法详解
- magic_quotes_gpc()和magic_quotes_runtime()
- 基于magic_quotes_gpc与magic_quotes_runtime的区别与使用介绍
- magic_quotes_gpc 合magic_quotes_runtime的区别!
- PHP中set_magic_quotes_runtime()和get_magic_quotes_gpc()
- magic_quotes_gpc与magic_quotes_runtime的异同点
- PHP中magic_quotes_gpc和 magic_quotes_runtime区别及其反斜线转义问题
- magic_quotes_runtime 与 magic_quotes_gpc
- get_magic_quotes_gpc() 和 set_magic_quotes_runtime() 的理解
- 基于magic_quotes_gpc与magic_quotes_runtime的区别与使用介绍
- set_magic_quotes_runtime(0|1) 和 magic_quotes_gpc 和 addslashes() 和 stripslashes()