时间:2020-09-04加入收藏
$url = $_GET['url'];
if (isset($_SERVER['HTTP_REFERER'],$url)){
if (stripos($_SERVER['HTTP_REFERER'], $_SERVER['HTTP_HOST']) === false){
echo json_encode(['code'=>500,"msg"=>"禁止盗用API"],JSON_UNESCAPED_UNICODE);
exit;
}
}else{
echo json_encode(['code'=>500,"msg"=>"禁止直接访问"],JSON_UNESCAPED_UNICODE);
exit;
}