I generate a JSON file with PHP and via the headers I download it as soon as the generation of the file is finished. When I run the code below, I look in my "downloads" folder and the extension of the downloaded file is not ".json" but ".json.html".
How to make the extension of the file remain ".json"?
Here is my code:
foreach($tickets as $ticket)
{
$data['tickets'][] = [
'tickets_id' => $ticket->ticket_id,
'name' => strtolower($ticket->name),
'email' => strtolower($ticket->email),
'status' => $ticket->status
];
}
header('Content-Type: application/json');
header('Content-Disposition: attachment; filename=db.json');
header('Pragma: no-cache');
echo json_encode($data);
Downloaded file is => db.json.html not db.json
from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/2r4jF5q
via IFTTT
Aucun commentaire:
Enregistrer un commentaire