有人知道为什么上面写着:
Deprecated: Assigning the return value of new by reference is deprecated in phpExcelReader'Excel'reader.php on line 261
$this->_ole =& new OLERead();
我用的是WAMP - PHP Version 5.3.13
可能是一些旧的php语法或方法,我改变了我的代码,它为我工作:
早些时候:
$this->_ole =& new OLERead();
改为:(去掉&&)
$this->_ole = new OLERead();
警告和通知现在消失了!
根据这里的建议http://code.google.com/p/php-excel-reader/issues/detail?id=82
问题在$ this -> _ole =,新OLERead ();很抱歉太明显了,但它可以被修复,比如,这个$t = new OLERead();$ this -> _ole =,$ t;
我把$this->_ole = new OLERead();
改成
$t = new OLERead();
$this->_ole =& $t;
没有错误消息,也没有导入数据。所以这一切都行得通。但不确定这一变化是否会引起一些其他问题。如果有人知道,请指教。
从PHP 5.3.0开始,当您使用&在foo(和一个美元);
http://php.net/manual/en/language.references.pass.php试试这个。
excel_reader2.php:
turn off://function OLERead(){}
和更改:
/**
* Constructor
*
* Some basic initialisation
function Spreadsheet_Excel_Reader($file='',$store_extended_info=true,$outputEncoding='') {
$this->_ole = new OLERead();
$this->setUTFEncoder('iconv');
if ($outputEncoding != '') {
$this->setOutputEncoding($outputEncoding);
}
for ($i=1; $i<245; $i++) {
$name = strtolower(( (($i-1)/26>=1)?chr(($i-1)/26+64):'') . chr(($i-1)%26+65));
$this->colnames[$name] = $i;
$this->colindexes[$i] = $name;
}
$this->store_extended_info = $store_extended_info;
if ($file!="") {
$this->read($file);
}
} */