严格的标准错误,无法解决


Strict standards error, unable to solve

我尝试过,但无法解决,已检查并在严格标准上得到错误

严格的标准:在…中只有变量应该通过引用传递。。。

我做错了什么-如何纠正

$this->assignRef('prodDet'  , $prodDet);
$this->assignRef('CatName'  , $modelNewcar->getCatName($id));
$this->assignRef('nav'  , $nav);
$this->assignRef('CatList'  , $modelNewcar->loadMainCat($brand,$Carmodel,$minprice,$maxprice,$fuel_type));
    $this->assignRef('CatName'  , $modelNewcar->getCatName);
parent::display($tpl);

下面是原始代码

function display($tpl = null)
{
    $mainframe =JFactory::getApplication();
    $option = JRequest::getCmd('option');
    $db         =JFactory::getDBO();
    $user               = JFactory::getUser();
    // Push a model into the view
    $model              = $this->getModel();
    $modelNewcar    = $this->getModel( 'product' );
    $id = JRequest::getVar('id','','default','int');
    $vid = JRequest::getVar('vid','','default','int');
    $prodDet = $modelNewcar->loadProduct($id,$vid);
    $this->assignRef('prodDet'  , $prodDet);
    $this->assignRef('CatName'  , $modelNewcar->getCatName($id));
    parent::display($tpl);
}
 function display($tpl = null)
{
    $db =JFactory::getDBO();
    $user               = JFactory::getUser();
    // Push a model into the view
    $model              =$this->getModel();
    $modelNewcar    =$this->getModel( 'category' );
    $brand = JRequest::getVar('brand','','default','int');
    $Carmodel = JRequest::getVar('model','','default','int');
    $minprice = JRequest::getVar('minprice','','default','int');
    $maxprice = JRequest::getVar('maxprice','','default','int');
    $fuel_type = JRequest::getVar('fuel_type','','default','');

        $this->assignRef('nav'  , $nav);
    $this->assignRef('CatList'  , $modelNewcar->loadMainCat($brand,$Carmodel,$minprice,$maxprice,$fuel_type));
        $this->assignRef('CatName'  , $modelNewcar->getCatName);
    parent::display($tpl);
}

这正是错误所说的。$this->assignRef()通过引用分配变量。

例如:

$this->assignRef('CatName'  , $modelNewcar->getCatName($id));

在这里,您尝试将函数getCatName()传递给assignRef()。解决方案是先将其分配给一个变量。

$catName = $modelNewcar->getCatName($id);
$this->assignRef('CatName'  , $catName);

文档:http://php.net/manual/en/language.references.pass.php