<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0">
<channel>
<title><![CDATA[BIWEB开源PHP WMS系统创始人ArthurXF肖飞的blog]]></title> 
<link>http://www.bizeway.net/index.php</link> 
<description><![CDATA[网务通 - 网务公司发展之路]]></description> 
<language>zh-cn</language> 
<copyright><![CDATA[BIWEB开源PHP WMS系统创始人ArthurXF肖飞的blog]]></copyright>
<item>
<link>http://www.bizeway.net/read.php?</link>
<title><![CDATA[魔法引用函数magic_quotes_gpc和magic_quotes_runtime的区别和用法]]></title> 
<author>ArthurXF &lt;arthurxf@gmail.com&gt;</author>
<category><![CDATA[PHP]]></category>
<pubDate>Tue, 30 Jan 2007 02:47:30 +0000</pubDate> 
<guid>http://www.bizeway.net/read.php?</guid> 
<description>
<![CDATA[ 
	　　PHP提供两个方便我们引用数据的魔法引用函数magic_quotes_gpc和magic_quotes_runtime，这两个函数如果在php.ini设置为ON的时候，就会为我们引用的数据碰到单引号'和双引号"是自动加上反斜线，帮我们自动转译符号，确保数据操作的正确运行，可是我们在php不同的版本或者不同的服务器配置下，有的magic_quotes_gpc和magic_quotes_runtime设置为on，有的又是off，所以我们写的程序必须符合on和off两种情况。那么magic_quotes_gpc和magic_quotes_runtime两个函数有什么区别呢？看下面的说明：<br/><div class="quote"><div class="quote-title">引用</div><div class="quote-content">magic_quotes_gpc <br/>作用范围是：ＷＥＢ客户服务端；<br/>作用时间：请求开始是，例如当脚本运行时．</div></div><br/><div class="quote"><div class="quote-title">引用</div><div class="quote-content">magic_quotes_runtime<br/>作用范围：从文件中读取的数据或执行exec()的结果或是从ＳＱＬ查询中得到的；<br/>作用时间：每次当脚本访问运行状态中产生的数据．</div></div><br/>所以<br/><div class="quote"><div class="quote-title">引用</div><div class="quote-content">magic_quotes_gpc的设定值将会影响通过Get/Post/Cookies获得的数据<br/>magic_quotes_runtime的设定值将会影响从文件中读取的数据或从数据库查询得到的数据</div></div><br/><br/>例子说明：<br/><br/><div class="code">$data1 = $_POST&#91;&#039;aaa&#039;&#93;;<br/>$data2 = implode(file(&#039;1.txt&#039;));<br/>if(get_magic_quotes_gpc()){<br/> &nbsp; &nbsp;//把数据$data1直接写入数据库<br/>}else{<br/> &nbsp; &nbsp;$data1 = addslashes($data1);<br/> &nbsp; &nbsp;//把数据$data1写入数据库<br/>}<br/><br/>if(get_magic_quotes_runtime()){<br/> &nbsp; &nbsp;//把数据$data2直接写入数据库<br/><br/> &nbsp;//从数据库读出的数据要经过一次stripslashes()之后输出<br/>}else{<br/> &nbsp; &nbsp;$data2 = addslashes($data2);<br/> &nbsp; &nbsp;//把数据$data2写入数据库<br/><br/> &nbsp;//从数据库读出的数据直接输出<br/>}</div><br/>　　另外magic_quotes_runtime可以通过set_magic_quotes_runtime设定，0 for off，1 for on。<br/>Tags - <a href="tag.php?tag=php" rel="tag">php</a> , <a href="tag.php?tag=magic_quotes_gpc" rel="tag">magic quotes gpc</a> , <a href="tag.php?tag=magic_quotes_runtime" rel="tag">magic quotes runtime</a>
]]>
</description>
</item><item>
<link>http://www.bizeway.net/read.php?&amp;guid=0#topreply</link>
<title><![CDATA[[评论] 魔法引用函数magic_quotes_gpc和magic_quotes_runtime的区别和用法]]></title> 
<author> &lt;user@domain.com&gt;</author>
<category><![CDATA[评论]]></category>
<pubDate>Thu, 01 Jan 1970 00:00:00 +0000</pubDate> 
<guid>http://www.bizeway.net/read.php?&amp;guid=0#topreply</guid> 
<description>
<![CDATA[ 
	
]]>
</description>
</item>
</channel>
</rss>