Make a php page to output json

by Prakash 2013-08-03 14:56:59

To make a php to output json you have to send the json header as follows. It will be helpful for ajax json responses :

header('Content-type:application/json');
$data = array('fruit' => 'apple','flower' => 'rose');
echo json_encode($data);
?>

Tagged in:

950
like
0
dislike
0
mail
flag

You must LOGIN to add comments