Answers for "php how to echo json object"

PHP
3

php echo json

<?php
$data = ['name' => 'John', 'age' => 35];
header('Content-type: Application/json');
echo json_encode($data);
Posted by: Guest on September-25-2020
5

php return json

header('Content-type: application/json');
echo json_encode($array);
Posted by: Guest on March-20-2020

Browse Popular Code Answers by Language