严格标准:只有变量才能在第777行的..中通过引用传递


Strict Standards: Only variables should be passed by reference in... on line 777

我在网站的某些页面上遇到错误:

严格标准:中只有变量应通过引用传递/主页/。。。777

这是这条线:

$arg_list = $this->_compile_arg_list('function', $tag_command, $attrs, $_cache_attrs='');

我应该更改什么?感谢您的帮助。

问题解决了,谢谢。

<?php
function foo(&$a){
}
$a = 33;
foo($a); // OK
foo(33); // Fatal error: Only variables can be passed by reference

因此,相应地修复您的代码。

您不能在函数调用中通过引用指定期望变量的值,如果您需要默认行为,您可以在函数本身或调用它之前设置它。

$_cache_attrs = '';
$arg_list = $this->_compile_arg_list('function', $tag_command, $attrs, $_cache_attrs);

也许'function'应该是可调用的。。

$function = function() { };
$arg_list = $this->_compile_arg_list(
    $function,
    $tag_command,
    $attrs,
    $_cache_attrs=''
);