HTTP防盗链
<?php if(isset($_SERVER['HTTP_REFERER'])) { //判断$_SERVER['HTTP_REFERER']是不是以http://localhost/http 开始 if(strpos($_SERVER['HTTP_REFERER'],"http://localhost/http")==0) { echo "显示信息"; }else { //跳转到警告页面 header("Location:warning.php"); } }else { header("Location:warning.php"); } ?>