send json reponse php 1

send json reponse php

header('Content-Type: application/json; charset=utf-8');
echo json_encode(array(
	"reponse": 200

Here is what the above code is Doing:
1. We’re using the header() function to set the Content-Type header to application/json.
2. We’re using the json_encode() function to convert the array to a JSON string.
3. We’re using the echo statement to output the JSON string.

Similar Posts