php 判断是否为AJAX请求
function isAjax($isPost = true)
{
if (isset($_SERVER['HTTP_X_REQUESTED_WITH']) && ($_SERVER['HTTP_X_REQUESTED_WITH'] == 'XMLHttpRequest')) {
if ($isPost) {
return (isset($_SERVER['REQUEST_METHOD']) && !strcasecmp($_SERVER['REQUEST_METHOD'], 'POST'));
} else {
return true;
}
} else {
return false;
}
}
当前页面是本站的「Google AMP」版。查看和发表评论请点击:完整版 »