2014-09-27 96 views
0
if ($file_extension == "xlsx") { 
    include("excel/PHPExcel.php"); 
    include("excel/Excel2007.php"); 
    $objPHPExcel = PHPExcel_IOFactory::load($_FILES['filename']['tmp_name']); 
    $sheetData = $objPHPExcel->getActiveSheet()->toArray(null, true, true, true); 
    foreach($sheetData as $row) { 
     //// How to put all cells in array in one shot because we can not assign each like $row['A'] ,$row['B'] 
     array_push($array, strval($row['A'])); 
     //row A2; 
     //array_push($array,strval($row['B'])); 
     //etc... 
    } 
} 

如何將所有單元格放入數組而不指定每個單元的名稱?如何在數組中插入()數據

因爲寫起來非常困難$row['A']$row['B'],$row['C'] ...... For Each。

如何將所有數據放入數組而不指定行的名稱?

回答

1

您可以合併數組

$array = array_merge($array, $row);