2015-10-26 56 views
-2

請幫助改正下面的代碼:PHP變量錯誤

PHP嚴格的標準:只有變量應當參照在/home/xxxxxx/public_html/app/mods/Controller/Menu.php傳遞第15行 的代碼如下:

public function __call($function, $parameters){ 
    $categoria = strtolower(str_replace('Action',NULL,$function)); 
    $platillo = strtolower(array_pop(array_flip($_GET)));//line 15 

預先感謝您

+0

你也許傳遞一個函數作爲$函數變量? –

回答

3

array_pop需要一個參考變量。參考意味着它必須是一個變量 - 例如,你可以這樣做:

$x = ["a", "b"]; 
array_pop($x); 

但不

array_pop(["a","b"]); 

所以,要解決你的問題,你會怎麼做:

$flipped_get = array_flip($_GET); 
$platillo = strtolower(array_pop($flipped_get));//line 15 
+0

謝謝戴夫,它完美的作品 –