SarkariResultess QA Bank

PHP JSON API response कैसे भेज सकते हैं? को debug कैसे करें?

Other 0 Views Verified
PHP JSON API response कैसे भेज सकते हैं? को debug कैसे करें? सही विकल्प चुनें और code/solution को समझें।
Sarkari Result QA Bank
Editorially reviewed exam information

Answer & Explanation

4 Answers
Verified

response.json($data);

response.json($data);
Additional Explanation
यह विकल्प सही Core PHP solution नहीं है।
Verified

print JSON($data);

print JSON($data);
Additional Explanation
यह विकल्प सही Core PHP solution नहीं है।
Verified

echo json($data);

echo json($data);
Additional Explanation
यह विकल्प सही Core PHP solution नहीं है।
Verified Correct Answer

header('Content-Type: application/json'); echo json_encode($data);

header('Content-Type: application/json'); echo json_encode($data);
Additional Explanation
JSON API में appropriate header और json_encode common pattern है। पहले exact error message, line number और input value check करें।