Detecting Ajax in PHP and making sure request was from my own website

前端 未结 7 1331
臣服心动
臣服心动 2020-11-29 23:31

I use my PHP back-end to detect AJAX requests by checking for a value in $_SERVER[\'HTTP_X_REQUESTED_WITH\'].

This gives me a reliable detection, making

7条回答
  •  爱一瞬间的悲伤
    2020-11-30 00:11

    Check the $_SERVER['HTTP_REFERER']. This will work in many cases, but shouldn't be confused for a completely-secure solution.

提交回复
热议问题