致命错误:function.php中的调用时引用传递已被删除


Fatal error: Call-time pass-by-reference has been removed in function.php

我正在使用WordPress作为网站,但是当我运行我的网站时,我得到标题中指定的错误消息。它说错误在文件functions.php中,在第32行。下面您可以找到这部分代码:

class Walker_Nav_Menu_Mobile extends Walker_Nav_Menu{
    // don't output children opening tag (`<ul>`)
    public function start_lvl(&$output, $depth){}
    // don't output children closing tag    
    public function end_lvl(&$output, $depth){}
    public function start_el(&$output, $item, $depth, $args){
      // add spacing to the title based on the current depth
      $item->title = str_repeat("&nbsp;", $depth * 4) . $item->title;
      // call the prototype and replace the <li> tag
      // from the generated markup...
      parent::start_el(&$output, $item, $depth, $args); // LINE 32 IS THIS ONE!
      $output = strip_tags($output, '<li><option>');
      $output = str_replace("</option>
</option>","</option>", $output);
      $output = str_replace('<li', '<option value="'.$item->url.'"', $output);
    }
    // replace closing </li> with the closing option tag
    public function end_el(&$output, $item, $depth){
      $output .= "</option>'n";
    }
}

从PHP 5.3.0开始,当您在函数调用上使用引用符号时,您将收到一个警告,说"调用时按引用传递"已弃用。只在函数定义中使用引用符号(通过引用传递)。

// wrong
parent::start_el( &$output, $item, $depth, $args );
// right
parent::start_el( $output, $item, $depth, $args );