PHP讀取Excel裡的檔案

來源:互聯網
上載者:User

標籤: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檔案有錯誤,請自己建立一個



聯繫我們

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