目前我有laravel v5.8.**
,并且有cyber-duck/laravel-excel
在我的controller
中,我有此工作代码
$excel = Importer::make('Excel');
$excel->load($savePath.$fileName);
$collection = $excel->getCollection();
if(sizeof($collection[1]) == 5)
{
return $collection;
}
else
{
return redirect()
->back()
->with(['errors'=> [0=> 'Please provide date in file according to your format.']])
->with('modal',$modal);
}
这是我的excel
当前输出为
[["id","username","name","email","birthdate"],[1,"j.doe17","Jun Doe","j.doe@gmail.com",{"date":"1996-09-07 00:00:00.000000","timezone_type":3,"timezone":"Asia\/Taipei"}],[2,"j.doe18","Jan Doe","jan.doe@gmail.com",{"date":"1996-09-07 00:00:00.000000","timezone_type":3,"timezone":"Asia\/Taipei"}]]
是否可以只获取没有headings/fields
的记录?
因为我将尝试将这些数据保存到我的数据库中