Call-time pass-by-reference has been deprecated 有關問題

來源:互聯網
上載者:User
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

如果你的朋友沒報該資訊,只是他的版本問題或設定或他屏蔽了錯誤資訊.

如果你的運行有其它問題,應該與此無關.

  • 聯繫我們

    該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

    如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.