php報錯:Deprecated: Assigning the return value of new by reference is deprecated in

來源:互聯網
上載者:User

很多朋友的php程式當php的版本升級到5.3以後,會出現”Deprecated: Assigning the returnvalue of new by reference is deprecatedin“ 顯示出來。這是因為5.3以後,不能使用”=&”符號,可以直接用”=”就可以了。

所以當出現這個問題後有兩種解決方案:

1. 把php的版本降級到5.3以下,但後退的不是明智的選擇。

2.  對程式中”=&”符號全部用”=” 代替。
 
http://www.tulongzhiji.com/php-deprecated-assigning-the-return-value-of-new-by-reference-is-deprecated-in/
昨晚用Spreadsheet_Excel_Reader匯入EXCEL內容到資料庫的時候,出現了以下提示:

Deprecated: Assigning the return value of new by reference isdeprecated in

定位到出錯的那一行:

1  $this->_ole=& new OLERead(); 

我本地環境用的是PHP/5.3.3。

下面這段話引用於因思而變

解決辦法:php5.3開始後,廢除了php中的”=&”符號,所以要想複製,直接用=引用即可。詳細如下:

1、PHP5對象複製是採用引用的方式;
2、如果不採用引用方式,則需要在複製對象時加關鍵字 clone;
3、如果在複製的過程中,同時要變更某些屬性,則增加函數_clone();

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.