Call-time pass-by-reference has been deprecated 問題
這是一個擷取本地IP的函數
源碼如下:
PHP code
public function winip( ) { @$this->execcmd( "ipconfig /all", &$this->return_array ); if ( $this->return_array ) { return $this->return_array; } $cmdir= $_SERVER['WINDIR']."\\system32\\ipconfig.exe"; if ( file_exists( $cmdir) ) { @$this->execcmd??( $_ocmdir ." /all", &$this->return_array ); } else { @$this->execcmd??( $_SERVER['WINDIR']."\\system\\ipconfig.exe /all", &$this->return_array ); } return $this->return_array; } public function linuxip( ) { @$this->execcmd ( "ifconfig -a", &$this->return_array ); return $this->return_array; } public function execcmd ( $a , $b) { $b=shell_exec($a); }}
執行後提示標題錯誤,請高手幫忙~
------解決方案--------------------
execcmd 後面有 ?? 是怎麼回事?
------解決方案--------------------
http://yourin.blogbus.com/logs/43604755.html
------解決方案--------------------
又被無視了,算……
------解決方案--------------------
@$this->execcmd和左括弧之間有unicode字元,難道你的編輯器沒顯示這個?
------解決方案--------------------
public function execcmd ( $a , $b)
{
$b=shell_exec($a);
}
在類內這樣寫會不會有問題?
你的出錯資訊主要是說引用傳遞被拋棄
會不會是這個? &$this->return_array
------解決方案--------------------
呵呵,
這句說的是不推薦對函數調用的參數使用"引用", 這個是php5(或5.3)後新引進的錯誤資訊,因為php5開始對象都是用引用操作的.
這隻是一個警告資訊,所以程式運行不應該被影響. 你可以屏蔽錯誤資訊,或將allow_call_time_pass_reference 設為true
如果你的朋友沒報該資訊,只是他的版本問題或設定或他屏蔽了錯誤資訊.
如果你的運行有其它問題,應該與此無關.