Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PHP force download json [duplicate]

Tags:

json

php

download

Possible Duplicate:
Forcing to download a file using PHP

If I have a json in a variable, how can I force the download? (The file not exist).

Thanks.

like image 363
keepyourweb Avatar asked Nov 28 '22 05:11

keepyourweb


1 Answers

header('Content-disposition: attachment; filename=file.json');
header('Content-type: application/json');
echo $json;
like image 132
Rocket Hazmat Avatar answered Dec 18 '22 09:12

Rocket Hazmat