Home >Backend Development >PHP Tutorial >Check if ajax request is made in php

Check if ajax request is made in php

巴扎黑
巴扎黑Original
2016-11-22 16:08:151171browse


$ajax = false;


if(!empty($_SERVER['HTTP_X_REQUESTED_WITH']) 

&& strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest') 

{

  $ajax = true;

}


Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn