首页 > 解决方案 > 如何解决这个 PHP 错误“只有变量应该通过引用传递”?

问题描述

首先,我对 PHP 完全陌生,以前从未这样做过.. 零技能.. 但我的任务是解决我工作中的一些错误,但我不知道该怎么办..

我这里有错误

代码:

<?$this->box->begin('rdgrey rdopen',null,'tree')?>
<?$this->box->headbegin();?>
    <span class="title"><?=lang('site_tree')?> </span>
<?$this->box->headend();?>
<?$this->box->contentbegin('');?>   

<?
  function pr(&$list,$key,&$c){
     echo '<ul class="tree">';
     $l=count(@$list[$key]);
     $i=0;
     if($l)
        foreach($list[$key] as $k=>$v){
            $has = count(@$c->content->config['has'][$v['type']]);
            echo '<li class="',($k==$l-1?'last ':''),(count(@$c->content->config['has'] 
         [$v['type']])?'folder ':'file ' ),
         (isset($list[$v['url']])?'open ':''),'type_',($v['type']),'"> 
         <span onClick="tree_tog(this)"></span><a href="',site_url('panel/'. 
         ($has?'index':'edit').'/'.$v['lang'].'/'.$v['nid'],null,false),'">
         ',character_limiter($v['name'],40),'</a>';
         if($v['type']!='root'&&isset($list[$v['url']]))
         pr($list,$v['url'],$c);
    
         echo '</li>';
         }
   //if($key)
   //echo '<li class="last"><a href="" onClick="return tognode(\'',$key,'\',this)">+</a></li>';

     echo '</ul>';
 }

  $lang = isset($_GET['lang']) ? $_GET['lang'] : @$node['lang'];
  pr($this->content->getTree(@$node['url'],$lang),'/',$this);

   ?>


   <?$this->box->contentend();?>   
   <?$this->box->end()?>

这条线有问题

pr($this->content->getTree(@$node['url'],$lang),'/',$this);

它是说只有变量应该通过引用传递。

有人可以帮助我吗?我应该如何解决这个问题?

标签: phpvariablesreference

解决方案


IncredibleHat确实您的回答是正确的。我必须创建变量并将此结果设置 $tmp = $this->content->getTree(@$node['url'],$lang)为它。

所有功劳归于IncredibleHat


推荐阅读