標籤:style blog http get 檔案 2014
下載phpExcelReader http://sourceforge.net/projects/phpexcelreader
解壓後得到下面這些檔案
jxlrwtest.xls這個excel檔案有錯誤,自己重建立了個
example.php和example2.php兩個檔案的輸出不一樣
example.php
example2.php
另外,在運行example.php的時候可能報一些錯誤,下面是在網上找的解決辦法:
錯誤一:Deprecated: Assigning the return value of new by reference is deprecated in D:\wamp\www\phpExcelReader\Excel\reader.php on line 262
這個是php5.3以後版本的問題,php5.3以下版本不會出現
$this->_ole =& new OLERead();
php5.3開始後,廢除了php中的”=&”符號,所以要想複製,直接用=引用即可
錯誤二:Warning: require_once(Spreadsheet/Excel/Reader/OLERead.php) [function.require-once]: failed to open stream: No such file or directory in D:\wamp\www\phpExcelReader\Excel\reader.php on line 31
修改辦法:
將require_once ‘Spreadsheet/Excel/Reader/OLERead.php‘;
改為:require_once ‘oleread.inc‘;
錯誤三:
Notice: iconv() [function.iconv]: Detected an illegal character in input string in D:\wamp\www\phpExcelReader\Excel\reader.php on line 1056
修改辦法:
將example.php裡面的
$data->setOutputEncoding(‘CP1251‘);
改為:
$data->setOutputEncoding(‘UTF-8‘); //或者你的程式編碼是gbk的就改為GB2312
錯誤四:下載的裡面的jxlrwtest.xls這個excel檔案有錯誤,請自己建立一個