php Ajax php响应头
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了php Ajax php响应头相关的知识,希望对你有一定的参考价值。
try {
...
} catch (Exception $e) {
header('HTTP/1.1 500 Internal Server Error');
header('Content-Type: application/json; charset=UTF-8');
die(json_encode(array('message' => 'ERROR')));
}
if ($response) {
header('HTTP/1.1 200 OK');
header('Content-Type: application/json; charset=UTF-8');
print json_encode(array('message' => 'OK'));
} else {
header('HTTP/1.1 500 Internal Server Error');
header('Content-Type: application/json; charset=UTF-8');
die(json_encode(array('message' => 'ERROR')));
}
以上是关于php Ajax php响应头的主要内容,如果未能解决你的问题,请参考以下文章