今天把php升級到php5.3之後出現在使用 =& 時提示PHP錯誤Deprecated: Assigning the return value of new by reference is deprecated in了,後來找了一些才發php5.3不支持=&了。
Deprecated: Assigning the return value of new by reference is deprecated in的解決辦法:
錯誤行:$mysql =& new mysql;
錯誤原因:php5.3開始後,廢除了php中的”=&”符號
解決辦法:
1.要想復制,直接用=引用即可。詳細如下:1、PHP5對象復制是采用引用的方式;
2、如果不采用引用方式,則需要在復制對象時加關鍵字 clone;
3、如果在復制的過程中,同時要變更某些屬性,則增加函數_clone();