如何在数组中推送()数据一次

时间:2014-09-27 02:23:03

标签: php arrays excel

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'] ......每个人都很难。

如何在不指定行名称的情况下将所有数据放入数组中?

1 个答案:

答案 0 :(得分:1)

您可以合并数组

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