PHP中如何防止外部恶意提交调用ajax接口,phpajax
我们自己网站写好的ajax接口,如果给自己用,那就限定一下来路域名,判断一下来路即可。
注意:将www.jb51.net替换成你自己的域名。
复制代码 代码如下://判断来路
if(!isset($_SERVER['HTTP_REFERER']) || !stripos($_SERVER['HTTP_REFERER'],'www.jb51.net')) {
echo 'cann`t access';
exit();
}
您可能感兴趣的文章:
- 防止ajax重复请求的方法(GET和POST)
- AJAX避免用户重复提交请求实现方案
- ajax 防止用户反复提交的2种解决方案
- AJAX提交表单数据实例分析
- 防止重复发送Ajax请求的解决方案

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

WebStorm Mac version
Useful JavaScript development tools

SublimeText3 English version
Recommended: Win version, supports code prompts!

SublimeText3 Mac version
God-level code editing software (SublimeText3)

PhpStorm Mac version
The latest (2018.2.1) professional PHP integrated development tool

Safe Exam Browser
Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.
