>  기사  >  php教程  >  PHP显示Deprecated: Assigning the return value of new by refe

PHP显示Deprecated: Assigning the return value of new by refe

WBOY
WBOY원래의
2016-06-06 20:02:131140검색

昨晚用Spreadsheet_Excel_Reader导入EXCEL内容到数据库的时候,出现了以下提示: Deprecated: Assigning the return value of new by reference is deprecated in 定位到出错的那一行: $this-_ole = new OLERead(); 我本地环境用的是PHP/5.3.3。 下面这段话

昨晚用Spreadsheet_Excel_Reader导入EXCEL内容到数据库的时候,出现了以下提示:

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

定位到出错的那一行:

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

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

下面这段话引用于因思而变

解决办法:php5.3开始后,废除了php中的”=&”符号,所以要想复制,直接用=引用即可。详细如下:

1、PHP5对象复制是采用引用的方式;
2、如果不采用引用方式,则需要在复制对象时加关键字 clone;
3、如果在复制的过程中,同时要变更某些属性,则增加函数_clone();

성명:
본 글의 내용은 네티즌들의 자발적인 기여로 작성되었으며, 저작권은 원저작자에게 있습니다. 본 사이트는 이에 상응하는 법적 책임을 지지 않습니다. 표절이나 침해가 의심되는 콘텐츠를 발견한 경우 admin@php.cn으로 문의하세요.