0

问题很简单:如何使用 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 关系有关,无论是什么......

4

1 回答 1

0

您必须phpexcel在 libary 文件夹中包含 libary,如下所示:

$this->load->libary('PHPExcel);

下载phpexcel并粘贴到库文件夹中。

于 2017-09-09T09:53:19.857 回答