傳遞給 Maatwebsite\Excel\Excel::download() 的參數(shù) 2 必須是字符串類型,給定的對象,在 C:\xampp\htdocs\student_route\vendor\laravel\framework\src\Illuminate\Support\Facades\Facade 中調(diào)用第 237 行的 .phppublic function excel_report() { $student_data = DB::table('student_details')->get()->toArray(); $student_array[] = array('Name', 'Address', 'Roll No', 'Class'); foreach($student_data as $student) { $student_array[] = array( 'Student Name' => $student->st_name, 'Address' => $student->address, 'Roll No' => $student->roll_no, 'Class' => $student->st_class ); } Excel::download('Student_Data', function($excel) use ($student_array){ $excel->setTitle('Student Datas'); $excel->sheet('Student_Datass', function($sheet) use ($student_array){ $sheet->fromArray($student_array, null, 'A1', false, false); }); })->download('xlsx'); }我收到錯誤參數(shù) 2 傳遞給 Maatwebsite\Excel\Excel::download() must be of the type string, object given.不知道問題出在哪里。任何人請檢查。我正在使用 Laravel 5.8
- 2 回答
- 0 關(guān)注
- 412 瀏覽
添加回答
舉報
0/150
提交
取消