if ($_SERVER['HTTP_REFERER'] == "????")
HTTP_REFERER
如果 JQuery $.post 请求到达此页面会怎样?
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