Phi*_*hov 6 php excel xls xlsx phpexcel
对不起,找不到我需要的东西.我有xls/xlsx.然后我得到像这样的smth:
array
0 =>
array
0 => string 'NameFirstColumn'
1 => string 'NameSecondColumn'
1 =>
array
0 => string 'qqq'
1 => float 30
2 =>
array
0 => string 'www'
1 => float 20
Run Code Online (Sandbox Code Playgroud)
第一行是具有值名称的标题.如何使PHPExcel转换为数组看起来像:
array
0 =>
array
NameFirstColumn => string 'qqq'
NameSecondColumn => float 30
1 =>
array
NameFirstColumn => string 'www'
NameSecondColumn => float 20
Run Code Online (Sandbox Code Playgroud)
Mar*_*ker 12
假设你已经有了这个数组 $array
$headings = array_shift($array);
array_walk(
$array,
function (&$row) use ($headings) {
$row = array_combine($headings, $row);
}
);
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
2176 次 |
| 最近记录: |