Answer the question
In order to leave comments, you need to log in
How to output JSON as a file through PHP?
I need to output JSON through PHP without .
This code will produce something like:<html>
echo(json_encode($result));
<html>
<head></head>
<body>
{"type": "virus", "name": "Petya"}
</body>
</html>
Answer the question
In order to leave comments, you need to log in
Use headers:
header("Content-type: application/json; charset=utf-8");
echo json_encode($result);
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question