<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0">
<channel>
<title><![CDATA[向东博客 专注WEB应用 构架之美 --- 构架之美，在于尽态极妍 | 应用之美，在于药到病除]]></title> 
<link>http://www.jackxiang.com/index.php</link> 
<description><![CDATA[赢在IT，Playin' with IT,Focus on Killer Application,Marketing Meets Technology.]]></description> 
<language>zh-cn</language> 
<copyright><![CDATA[向东博客 专注WEB应用 构架之美 --- 构架之美，在于尽态极妍 | 应用之美，在于药到病除]]></copyright>
<item>
<link>http://www.jackxiang.com/post//</link>
<title><![CDATA[ Warning: Call-time pass-by-reference has been deprecated解决方法]]></title> 
<author>jack &lt;xdy108@126.com&gt;</author>
<category><![CDATA[Php/Js/Shell/Go]]></category>
<pubDate>Tue, 26 Aug 2014 08:12:00 +0000</pubDate> 
<guid>http://www.jackxiang.com/post//</guid> 
<description>
<![CDATA[ 
	/*<br/>Warning: Call-time pass-by-reference has been deprecated - argument passed by value; If you would like to pass it by reference, modify the declaration of getimagesize(). If you would like to enable call-time pass-by-reference, you can set allow_call_time_pass_reference to true in your INI file. However, future versions may not support this any longer. ind:&#92;vhost&#92;include&#92;inc_custom_fields.php on line178<br/>*/<br/><br/>我把php.ini的display_errors = on改成display_errors = off // (不显示错误)<br/>就不显示了。<br/><br/>虽然没有什么影响。但是心里还是有个疙瘩。。。<br/>百度上没有找到什么答案，然后在google上 找到了。<br/><br/>修改php.ini就可以了。 <br/><br/>1. 在PHP.ini中搜索关键字 : allow_call_time_pass_reference 没有的自行建立。<br/>2. 将 Off 改成 On ,Web Server重起就OK了~<br/>allow_call_time_pass_reference = Off 变成 allow_call_time_pass_reference = On<br/><br/><br/>ps<br/><br/>文档注解为：<br/><br/>是否启用在函数调用时强制参数被按照引用传递。此方法已不被赞成并在 PHP/Zend 未来的版本中很可能不再支持。鼓励使用的方法是在函数定义中指定哪些参数应该用引用传递。鼓励大家尝试关闭此选项并确保脚本能够正常运行，以确保该脚本也能在未来的版本中运行（每次使用此特性都会收到一条警告，参数会被按值传递而不是按照引用传递）。<br/><br/>在函数调用时通过引用传递参数是不推荐的，因为它影响到了代码的整洁。如果函数的参数没有声明作为引用传递，函数可以通过未写入文档的方法修改其参数。要避免其副作用，最好仅在函数声明时指定那个参数需要通过引用传递。<br/><br/> <br/>可以在函数里修改外面变量的值：<br/><textarea name="code" class="php" rows="15" cols="100">
&lt;?php
function test2($a, &amp;$b) &#123;//修改函数外面的变量值
//function test2($a, &amp;$b) &#123;//无&amp;是无法修改外面的值的。
&nbsp;&nbsp;$b = &quot;fun_test2&quot;;
&nbsp;&nbsp;return;
&#125;

$a = &quot;a_value&quot;;
$b = &quot;b_value&quot;;

test2($a, $b);
echo $b;
?&gt;
</textarea><br/><br/>这样写就有前面描述的一系列问题：<br/><textarea name="code" class="php" rows="15" cols="100">
&lt;?php
function test1($a, $b) &#123;
&nbsp;&nbsp;$b = &quot;fun_test1&quot;;
&nbsp;&nbsp;return;
&#125; 

$a = &quot;a_value&quot;;

$b = &quot;b_value&quot;;

test1($a, &amp;$b);
?&gt;
</textarea><br/><br/>说白了就是不能传一个地址给一个定义的函数参数里不是地址，这会有问题。<br/>这块特别是在foreach这块的php实现上可能有一点缺陷也好，总之，想抛弃c的&amp;取地址符号是php简单的根源。<br/><br/>执行结果如下：<br/>---------- 调试PHP ----------<br/>Deprecated: Call-time pass-by-reference has been deprecated; If you would like to pass it by reference, modify the declaration of test1().&nbsp;&nbsp;If you would like to enable call-time pass-by-reference, you can set allow_call_time_pass_reference to true in your INI file in D:&#92;wamp&#92;www&#92;array_walk.php on line 11<br/><br/>PHP Deprecated:&nbsp;&nbsp;Call-time pass-by-reference has been deprecated; If you would like to pass it by reference, modify the declaration of test1().&nbsp;&nbsp;If you would like to enable call-time pass-by-reference, you can set allow_call_time_pass_reference to true in your INI file in D:&#92;wamp&#92;www&#92;array_walk.php on line 11<br/>输出完成 (耗时 0 秒) - 正常终止<br/><br/><br/><br/>像pdo的foreach陷阱和这有关，究其原因, 也就是bindParam和bindValue的不同之处, bindParam要求第二个参数是一个引用变量(reference)，引用这种东东在PHP里出现其实怎么说好呢，有它有好处，用不好大大的坏，陷阱的根源，像c不是c的PHP的问题是PHP发展的争议根源，如果多都用c里的特性，那PHP完全可以成为一个类java的常驻内存server，乃至内存实现上也可有进步，但会编写复杂，掌握难度加大：<br/>http://weibo.com/1170999921/ylgFcpe1f<br/>http://www.laruence.com/2012/10/16/2831.html<br/>https://jackxiang.com/post/7425/
]]>
</description>
</item><item>
<link>http://www.jackxiang.com/post//#blogcomment</link>
<title><![CDATA[[评论]  Warning: Call-time pass-by-reference has been deprecated解决方法]]></title> 
<author> &lt;user@domain.com&gt;</author>
<category><![CDATA[评论]]></category>
<pubDate>Thu, 01 Jan 1970 00:00:00 +0000</pubDate> 
<guid>http://www.jackxiang.com/post//#blogcomment</guid> 
<description>
<![CDATA[ 
	
]]>
</description>
</item>
</channel>
</rss>