0
我遇到了一個奇怪的問題,我無法強制Laravel自動下載導出工作表。強制Laravel 4.2使用Laravel-Excel自動下載導出的工作表
我知道工作表正在生成,因爲我點擊鏈接後(在底部)我被帶到一個空白頁面 - 如果我在該頁面上刷新,我會自動下載我剛剛導出的工作表和它看起來不錯。我想要做的就是讓工作表自動下載,但留在主頁上。
我的控制器:
public function ListAll()
{
Excel::create('Users', function($excel) {
$excel->sheet('Users', function($sheet) {
$users = User::orderBy('End_Enrollment','asc')->get();
$sheet->fromArray($users);
});
})->export('xlsx'); // Have also tried ->download('xlsx') and have same issue.
return View::make('/');
}
我的路線:
Route::get('/all', '[email protected]');
網站上的鏈接(HTML):
Click <a href="/all">here</a> to export the entire database.
我已閱讀有關響應::方法,但我並不熟悉它。