I would like to learn how to read excel file using PHP. In my particular case of using PHPExcel from Yii.
I followed numerous tutorials and I was always stuck in one place: "ZipArchive :: getFromName (): Invalid or unified Zip object." I added extensions, bootloader, etc., but nothing works. is there any way around this? or do i need to get another library? Here is the code in my controller.
Yii::import('application.vendors.PHPExcel.PHPExcel',true); $objReader = PHPExcel_IOFactory::createReader('Excel2007'); $objPHPExcel = $objReader->load('c:\cctv.xls');
this is a detailed error:
C: \ WAMP \ WWW \ for example \\ protected providers \ PHPExcel \ PHPExcel \ read \ Excel2007.php (272)
} public function _getFromZipArchive(ZipArchive $archive, $fileName = '') {
Stack Trace C: \ wamp \ www \ trunk \ protected \ vendors \ PHPExcel \ PHPExcel \ Reader \ Excel2007.php (272): ZipArchive-> getFromName ("_ rels / .rels")
$fileName = substr($fileName, strpos($fileName, '//') + 1); } $fileName = PHPExcel_Shared_File::realpath($fileName);
C: \ wamp \ www \ example \ protected \ vendors \ PHPExcel \ PHPExcel \ Reader \ Excel2007.php (312): PHPExcel_Reader_Excel2007 → _ getFromZipArchive (ZipArchive, "_rels / .rels")
$excel->removeCellXfByIndex(0);
C: \ wamp \ www \ example \ protected \ controllers \ AdminController.php (58): PHPExcel_Reader_Excel2007-> load ("c: \ cctv.xls")
public function actionCreateSource() { Yii::import('application.vendors.PHPExcel.PHPExcel',true); $objReader = PHPExcel_IOFactory::createReader('Excel2007'); $objPHPExcel = $objReader->load('c:\cctv.xls');
rodrigue
source share