I get the issue in my code What I want: after clicking on the export button, one CSVfile would be automatic download from the browser.
but it only displays the data in network tab in inspect element but not downloading.
public function Exportcsv(Request $recuestdata) {
$headers = array(
"Content-type" => "text/csv",
"Content-Disposition" => "attachment; filename=file.csv",
"Pragma" => "no-cache",
"Cache-Control" => "must-revalidate, post-check=0, pre-check=0",
"Expires" => "0"
);
$filename = "order";
$output = fopen($filename, 'w+');
$data=json_decode($recuestdata['row']);
foreach ($data as $line) {
fputcsv($output, $line);
}
return Response::download($filename, 'order.csv', $headers);
}
from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2sq7Sgw
via IFTTT
Aucun commentaire:
Enregistrer un commentaire