当我加载任何文件 xls,但总是给出文本。我做这一切: DOM 元素:HTML DOM 元素:正文 DOM 元素:P 段落开头:段落结尾:冲洗单元格:A1 => ÐÏ
$ aSheet = $ objPHPExcel-> getActiveSheet ();
外部文件中没有数据怎么办?
我的代码:
function getXLS($xls) {
include_once '/server_name/public_html/PHPExcel/Classes/PHPExcel/IOFactory.php';
$objPHPExcel = PHPExcel_IOFactory::load($xls);
$objPHPExcel->setActiveSheetIndex(0);
$aSheet = $objPHPExcel->getActiveSheet();
$array = array();
foreach($aSheet->getRowIterator() as $row) {
$cellIterator = $row->getCellIterator();
$item = array();
foreach($cellIterator as $cell) {
array_push($item, $cell->getCalculatedValue());
}
return $array;
}
$excel_file = $_FILES['excel_file'];
if( $excel_file )
$excel_file = $_FILES['excel_file']['tmp_name'];
if($_FILES['excel_file']['tmp_name']) {
$xlsData = getXLS($excel_file);
}
}