一闪盔、http防盜鏈:
鏈接html:
<!DOCTYPE html>
<html>
<head>
<title>查看信息頁面</title>
<meta charset="utf-8">
</head>
<body>
<a href="http://localhost/PHPCode/Weekend0326/Http.php">查看lizzy的信息</a>
</body>
</html>
跳轉(zhuǎn)的php:
<?php
if (isset($_SERVER['HTTP_REFERER'])) {
//判斷$_SERVER['HTTP_REFERER']是不是以http://localhost/http 開始->函數(shù)
if (strpos($_SERVER['HTTP_REFERER'], "http://localhost/http") == 0) {
echo "查詢到了lizzy的信息";
} else {
echo "是打的撒多所無無多";
header("Location:Warning.php");
}
} else {
//沒有防盜鏈
header("Location:Warning.php");
}
?>
防盜鏈警告php:
<!DOCTYPE html>
<html>
<head>
<title>warning</title>
</head>
<body>
<h1>非法盜鏈者</h1>
</body>
</html>
二、http響應(yīng):
簡單定義:一個(gè)http響應(yīng)代表服務(wù)器給瀏覽器回送的數(shù)據(jù)辱士,同時(shí)告訴瀏覽器應(yīng)當(dāng)怎樣處理數(shù)據(jù)泪掀。
基本結(jié)構(gòu):