php中检查是否ajax请求
程序员文章站
2022-04-10 12:01:01
...
$ajax = false;
if(!empty($_SERVER['HTTP_X_REQUESTED_WITH'])
&& strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest')
{
$ajax = true;
}