Home  >  Article  >  php教程  >  PHP中如何判断AJAX提交的数据

PHP中如何判断AJAX提交的数据

WBOY
WBOYOriginal
2016-06-06 20:40:101119browse

这是一个比较常用的方法,有时候我们需要知道一个页面是被直接访问的还是通过ajax来访问的

如果是ajax请求,以下表达式的值为真
$_SERVER["HTTP_X_REQUESTED_WITH"]==”XMLHttpRequest”
就是一个PHP的环境变量。
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