2013-01-24 70 views
0

我剛安裝了xampp,運行一些舊的程序(創建2年或更多年前),我得到3我無法弄清楚的錯誤。php版本升級導致舊程序錯誤

  1. 嚴格的標準:只有變量應參考在C傳遞:\ XAMPP \ htdocs中\ 2010 \在線網\核心\路徑\ route.php 117
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我無法理解,它不是通過引用傳遞,爲什麼有一個錯誤?

+0

哪條線是在這種情況下,線117? – DWright

+0

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

+0

最終功能是什麼樣的? – DWright

回答

4

由於end()需要通過引用傳遞的參數,所以不能將其與非變量(如另一個函數調用或構造的直接結果)一起使用。

從參數定義報價在manual

這意味着你必須通過一個真正的變量,而不是一個函數返回一個數組,因爲只有實際變量可以通過引用傳遞。

變化

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

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

你是如此強大 – hkguile

相關問題