[請益] phpexcel問題
各位版上大大好
小弟再用phpexcel讀取.xls檔案時發生了錯誤
Fatal error: Uncaught exception 'Exception' with message 'ZipArchive library
is not enabled' in
C:\AppServ\www\phpexcel\Classes\PHPExcel\Reader\Excel2007.php:240 Stack
trace: #0 C:\AppServ\www\phpexcel\load.php(7):
PHPExcel_Reader_Excel2007->canRead('jxlrwtest.xls') #1 {main} thrown in
C:\AppServ\www\phpexcel\Classes\PHPExcel\Reader\Excel2007.php on line 240
我試過網路上許多方法
都不行
所以想請各位幫忙想想辦法
以下是我的程式碼
<?
require_once('../phpexcel/classes/PHPExcel.php');//加载PHPExcel
$fileName = 'jxlrwtest.xls';
$filePath = $fileName;
$PHPExcel = new PHPExcel();
$PHPReader = new PHPExcel_Reader_Excel2007();
if(!$PHPReader->canRead($filePath)){
$PHPReader = new PHPExcel_Reader_Excel5();
if(!$PHPReader->canRead($filePath)){
echo 'no Excel';
return ;
}
}
$PHPExcel = $PHPReader->load($filePath);
//$currentSheet = $PHPExcel->getSheet(0);
/**取得一共有多少列*/
$allColumn = $currentSheet->getHighestColumn();
/**取得一共有多少行*/
$allRow = array($currentSheet->getHighestRow());
for($currentRow = 1;$currentRow<=$allRow;$currentRow++){
for($currentColumn='A';$currentColumn<=$allColumn;$currentColumn++){
$address = $currentColumn.$currentRow;
echo $currentSheet->getCell($address)->getValue()."\t";
}
echo "\n";
}
?>
謝謝各位
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 140.131.39.60
PHP 近期熱門文章
PTT數位生活區 即時熱門文章