这是函数,错误位于 '$data = Excel::load($path)->get();' 中的第 25 行 说非静态方法“load”不应静态调用:function import(Request $request) { $this->validate($request, [ 'select_file' => 'required|mimes:xls,xlsx' ]); $path = $request->file('select_file')->getRealPath(); $data = Excel::load($path)->get(); if($data->count() > 0) { foreach($data->toArray() as $key => $value) { foreach($value as $row) { $insert_data[] = array( 'zi' => $row['zi'], 'siteId' => $row['siteId'], 'gsmId' => $row['gsmId'], 'topoCont' => $row['topoCont'], 'plannRedr' => $row['plannRedr'], 'Country' => $row['country'], 'dateReal' => $row['dateReal'], 'semReal' => $row['semReal'], 'statuts' => $row['country'], ); } } if(!empty($insert_data)) { DB::table('tbl_customer')->insert($insert_data); } } return back()->with('success', 'Excel Data Imported successfully.'); } }
- 1 回答
- 0 关注
- 107 浏览
添加回答
举报
0/150
提交
取消