问题很简单:如何使用PHP Excel加载此Excel工作簿(http://wftda.com/stats/wftda-stats-book.xlsx)而不会抛出任何错误?
我使用以下代码(或多或少是文档中解释的mwe):
$inputFileType = 'Excel2007';
$inputFileName = path_to/wftda-stats-book.xlsx';
//Create a new Reader of the type defined in $inputFileType
$objReader = PHPExcel_IOFactory::createReader($inputFileType);
//Load $inputFileName to a PHPExcel Object
$objPHPExcel = $objReader->load($inputFileName);
治疗5秒左右后,我得到以下错误:
Notice: Trying to get property of non-object in /srv/web/www/dev/arbitrage/_inc/lib/PHPExcel/Classes/PHPExcel/Reader/Excel2007.php on line 1378
Warning: Invalid argument supplied for foreach() in /srv/web/www/dev/arbitrage/_inc/lib/PHPExcel/Classes/PHPExcel/Reader/Excel2007.php on line 1378
Notice: Undefined offset: 0 in /srv/web/www/dev/arbitrage/_inc/lib/PHPExcel/Classes/PHPExcel/Reader/Excel2007.php on line 1394
Fatal error: Call to a member function attributes() on a non-object in /srv/web/www/dev/arbitrage/_inc/lib/PHPExcel/Classes/PHPExcel/Reader/Excel2007.php on line 1396
错误所在的代码部分似乎与vml关系有关,无论是什么......
答案 0 :(得分:0)
您必须在libary文件夹中包含phpexcel
libary,如下所示:
$this->load->libary('PHPExcel);
下载phpexcel
并将其粘贴到libary文件夹中。