Strict Standards: Only variables should be passed by reference in ... on line xxx

  • 620
  • 0
  • PHP
  • 2015-11-27

Strict Standards: Only variables should be passed by reference in ... on line xxx

當出現下列訊息

Strict Standards: Only variables should be passed by reference in ... on line xxx

跟著路徑和行號,找到問題程式碼如下:

$ext = strtolower(array_pop(explode('.',$filename)));

 

如果php版本在5.3以上,此寫法會出現Strict Standards(嚴格標準)訊息。

只要改寫一下,即可解決此問題,改寫程式如下:

$ext = explode('.',$filename);

$ext = strtolower(array_pop($ext));

 

因此,如遇到這訊息,可以嘗試將原先的程式碼拆開改寫一下,即可解決問題。

 

 

 

參考或是複製語法時,別忘了留個言喔 ^ ^ ~