這是函數(shù),錯(cuò)誤位于 '$data = Excel::load($path)->get();' 中的第 25 行 說(shuō)非靜態(tài)方法“l(fā)oad”不應(yīng)靜態(tài)調(diào)用: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.'); } }
非靜態(tài)方法“load”不應(yīng)靜態(tài)調(diào)用
三國(guó)紛爭(zhēng)
2023-07-15 17:43:19