gpt4 book ai didi

php - Laravel Excel - 仅返回行的第一列

转载 作者:行者123 更新时间:2023-12-04 21:07:50 25 4
gpt4 key购买 nike

我正在尝试通过 Laravel Excel ( http://www.maatwebsite.nl/laravel-excel/docs ) 导入 Excel 数据。我正在使用 Laravel 4.2。

但我只得到结果中行的第一列,对我来说似乎很奇怪,我知道为什么。

Excel::selectSheetsByIndex(0)->load("fileName.xlsx", function($reader) {
$reader->skip(14);
dd($reader->first());
});

我得到这个结果:
object(Maatwebsite\Excel\Collections\CellCollection)#19057 (2) {
["title":protected]=> NULL ["items":protected]=> array(2) {
["flik_1_personal"]=> string(7) "Annika " [0]=> NULL
}
}

由于 Excel 文件看起来很精简(行):
enter image description here

我希望得到所有的细胞,但事实并非如此。有谁知道为什么会这样?
谢谢!

更新
看起来这是因为我没有其他单元格的任何“标题”(名字除外,它显示在结果中)。是否有获取单元格值的设置,没有“标题”?

最佳答案

尝试这个

Excel::selectSheetsByIndex(0)->load($file, function($reader) {

foreach ($reader->toArray() as $row) {
$bb[] = $row;
}
echo '<pre>';print_r($bb );echo '</pre>'; die();


});

关于php - Laravel Excel - 仅返回行的第一列,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32797677/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com