时间:2021-07-01 10:21:17 帮助过:4人阅读
[php]
require_once SITE_PATH.'/PHPExcle/Classes/PHPExcel.php';
require_once SITE_PATH.'/PHPExcle/Classes/PHPExcel/IOFactory.php';
require_once SITE_PATH.'/PHPExcle/Classes/PHPExcel/Reader/Excel5.php';
$objReader = PHPExcel_IOFactory::createReader ( 'Excel5' );
$objPHPExcel = $objReader->load ( $fileurl );
$sheet = $objPHPExcel->getSheet ( 0 );
$highestRow = $sheet->getHighestRow ();
$highestColumn = $sheet->getHighestColumn ();
for($j = 2; $j <= $highestRow; $j ++){
for($k = 'A'; $k <= $highestColumn; $k ++) {
$array[$j][$k] = (string)$objPHPExcel->getActiveSheet ()->getCell ( "$k$j" )->getValue ();
}
}
?>
也就是在$objPHPExcel->getActiveSheet ()->getCell ( "$k$j" )->getValue ();的前面加一个(string)就好了
就是这么简单!
http://www.bkjia.com/PHPjc/478282.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/478282.htmlTechArticle在使用phpExcel的过程中,难免会遇到各种各样的问题,在导入excel表格尤其如此,我们总是不能从编辑那里获得期望的excel数据,比如下面的...