2
if ($_SERVER['HTTP_REFERER'] == "????")

HTTP_REFERER如果 JQuery $.post 请求到达此页面会怎样?

4

1 回答 1

4

try

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

Note That not all servers provide this variable

and you can read this Detecting Ajax in PHP and making sure request was from my own website

于 2012-03-14T04:48:19.463 回答