0
我正在導出數據爲csv它的下載只有第1 9條記錄總數10在excel 1st是標題和9條記錄,然後我想導出整個從db表不知道什麼出了錯這裏是以下方法不下載整個表格作爲.csv文件導出只有10條記錄(laravel 5.3)
public function ExportAll(){
$student = Students::all();
$temp = tmpfile();
$heading = array('Name', 'Group');
fputcsv($temp, $heading);
foreach($student as $row) {
fputcsv($temp, array($row['name'],$row['group']));
}
fseek($temp, 0);
echo fread($temp, 1024);
header('Content-Type: text/csv; charset=utf-8');
header('Content-Disposition: attachment; filename=Student.csv');
fclose($temp);
die;
}
其下載我想下載整個表USIG這種方法只有一排 請幫助解決 路線是
Route::get('/student/ExportAll', '[email protected]');
在這裏我有鏈接導出as
<a href="/student/ExportAll">Export</a>
它給出了一個錯誤,因爲**數組到字符串轉換** –
現在它的下載只是我10我有更新我的問題請審查 –