之前遇到过的问题,一直很苦恼,到底该怎么解决,现在终于找到了解决的方法,现在分享给大家看下,问题如下所示:
Strict Standards: Only variables should be passed by reference in upload/includes/cls_template.php on line 418
第418行:$tag_sel = array_shift(explode(' ', $tag));
解决办法 1:
5.3以上版本的问题,应该也和配置有关 只要418行把这一句拆成两句就没有问题了 $tag_sel = array_shift(explode(' ', $tag)); 改成:
$tag_arr = explode(' ', $tag); $tag_sel = array_shift($tag_arr);
(实验过,绝对可行) 因为array_shift的参数是引用传递的,5.3以上默认只能传递具体的变量,而不能通过函数返回值
同理举一反三:遇到函数嵌套错误时可以分开写,错误自然解决
如:
function get_dyna_libs($theme, $tmp)
{
$extsub = explode('.', $tmp);
$ext = end($extsub);
$tmp = basename($tmp,".$ext");
$sql = 'SELECT region, library, sort_order, id, number, type' .
' FROM ' . $GLOBALS['ecs']->table('template') .
" WHERE theme = '$theme' AND filename = '" . $tmp . "' AND type > 0 AND remarks=''".
' ORDER BY region, library, sort_order';
$res = $GLOBALS['db']->getAll($sql);
$dyna_libs = array();
foreach ($res AS $row)
{
$dyna_libs[$row['region']][$row['library']][] = array(
'id' => $row['id'],
'number' => $row['number'],
'type' => $row['type']
);
}
return $dyna_libs;
}
将$ext = end(explode('.', $tmp));
改为
$extsub = explode('.', $tmp);
$ext = end($extsub);
解决办法 2(屏蔽错误) :
或则如果这样配置的话: error_reporting = E_ALL | E_STRICT
php.ini中有如下设置:
error_reporting = E_ALL | E_STRICT
这是说,显示那些不符合编码规范的警告(coding standards warnings)。
Joomla其实是建议取消error的输出,如果出于调试需要,应改为
error_reporting = E_ALL & ~E_NOTICE
问题得到解决。
建站咨询热线
18503087281