php版本升级导致旧程序出错

时间:2013-01-24 08:43:45

标签: php xampp

我刚刚安装了xampp,运行一些旧程序(2年或更久以前创建),我得到了3个我无法弄清楚的错误。

  
      
  1. 严格标准:只应在第117行的C:\ xampp \ htdocs \ 2010 \ web \ core \ route \ route.php中通过引用传递变量
  2.   
    public function loadClass($address,$ext='') {
        $this->extname = preg_replace('/_/','/',$address,3);
line:117>       $this->classname = end(explode('_',$address)).($e= $ext!='' ? '('.$ext.')' :  '');
        include_once(ROOT_ROUTE.'/'.$this->extname.'.php');
        $this->newclass = new $this->classname;
        return $this->newclass;
    }

第117行我无法理解,它不是通过引用传递,为什么会出错?

1 个答案:

答案 0 :(得分:4)

因为end()需要通过引用传递的参数,所以不能将它与非变量一起使用,例如另一个函数调用或构造的直接结果。

引用manual中的参数定义:

  

这意味着你必须传递一个实变量,而不是一个返回数组的函数,因为只有实际的变量可以通过引用传递。

更改

$this->classname = end(explode('_',$address)).($e= $ext!='' ? '('.$ext.')' :  '');

$addressTemp = explode('_',$address);
$this->classname = end($addressTemp) . ($e= $ext!='' ? '('.$ext.')' :  '');