CUTENEWS.RU - 严格的标准:只有变量应该通过引用传递

这段代码有问题,有帮助吗?


$var = reset($sql -> select(array(

  'table' => 'news',

  'join' => array('table' => 'story', 'where' => 'id = post_id'),

  'where' => array("id = $id", 'or', "url = $id")

)));

错误:


Strict Standards: Only variables should be passed by reference in


$query = reset(  

    $sql->select(array(  

        'table'     => 'news',  

        'where'     => $where  

)));   

Strict Standards: Only variables should be passed by reference in


ITMISS
浏览 76回答 1
1回答

慕娘9325324

看看这里。reset()function 正在等待一个变量引用,而不是你传递给它一个function result。您可以提取函数的结果,然后将其传递给reset()如下所示。$select = $sql -> select(array(  'table' => 'news',  'join' => array('table' => 'story', 'where' => 'id = post_id'),  'where' => array("id = $id", 'or', "url = $id")))$var = reset($select);然后是另一个:$select1 = $sql->select(array(             'table'      => 'news',             'where'      => $where            ));$query = reset($select1);
打开App,查看更多内容
随时随地看视频慕课网APP