使用codeigniter 2.0读取XLS文件 [英] Reading an XLS file with codeigniter 2.0
问题描述
我遇到了以下问题。
我试图读取一个excel 97 - 2003(XLS)文件。
文件位于codeigniter文件夹中。
目前我使用
spreadsheet_excel_reader.php 库读取XLS文件。
I am trying to read an excel 97 - 2003 (XLS) file. The file is located within the codeigniter folder. Currently i am using the spreadsheet_excel_reader.php library to read the XLS file.
不幸的是,我无法得到它的工作,它确认XLS文件,并且读取文件,但当它完成解析文件,它返回 NULL
Unfortunately i cannot get it working, it does recognize the XLS file and also reads the file, but when it's done parsing the file, it returns NULL
这是我的方法。
$CI =& get_instance();
$this->data_file = "./xls/BolFeed.xls"; //The XLS file and folder
//$CI->spreadsheet_excel_reader->setOutputEncoding('CP1251'); //I've added this one into the library itself.
$CI->spreadsheet_excel_reader->read($this->data_file); //Start reading the XLS file
$this->data_array = $this->spreadsheet_excel_reader->sheets[0]; //This should return my XLS but only returns NULL
var_dump($this->data_array);
die;
我认为该方法不会导致问题,但XLS解析库。
I think the method does not cause the problem, but the XLS parse library does.
我希望你们可以帮助我,因为我一直在努力解决这个问题几天。
I hope you guys can help me out, because i've been struggling with this problem for days.
PHP 5.3.0和CI 2.0.0
I am using PHP 5.3.0 and CI 2.0.0
感谢您的努力。
推荐答案
不应 $ this-> spreadsheet_excel_reader->张
为 $ CI- spreadsheet_excel_reader->张
,因为您正在上面
shouldn't $this->spreadsheet_excel_reader->sheets
be $CI->spreadsheet_excel_reader->sheets
as you are calling $CI->spreadsheet_excel_reader->read
in the line above
这篇关于使用codeigniter 2.0读取XLS文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!