2012-09-23 36 views
0

我已經升級,從V5.3版本的PHP V5.4,現在我收到以下錯誤:變量引用錯誤的PHP

Strict standards: Only variables should be passed by reference

代碼:

$filename = array_pop(explode("/", $_SERVER['SCRIPT_FILENAME'])); 

如何解決這一問題?

+6

試'$ filename_arr =爆炸( 「/」,$ _SERVER [ 'SCRIPT_FILENAME']); $ filename = array_pop($ filename_arr);' – air4x

+1

'array_pop'期望一個變量,因爲它試圖從中刪除最後一項。 – Gumbo

+0

[嚴格標準:只有變量應通過引用傳遞]的可能重複(http://stackoverflow.com/questions/2354609/strict-standards-only-variables-should-be-passed-by-reference) –

回答

3

打破代碼分開就解決了錯誤

$filename = explode("/", $_SERVER['SCRIPT_FILENAME']); 
$filename = array_pop($filename); 

echo $filename ; 

Demo Break Apart