Answers for "php return json with header"

PHP
1

php header json

header('Content-Type: application/json');
echo json_encode($data);
Posted by: Guest on March-03-2021
2

php return json data

header('Content-Type: application/json'); 

$colors = array("red","blue","green");
echo json_encode($colors);
Posted by: Guest on October-30-2019

Browse Popular Code Answers by Language