目录
方法一
步骤一
1:网站根目录新建 img.php ,代码如下:
<?php /* '软件名称:苹果CMS 源码库:https://github.com/magicblack '-------------------------------------------------------- 'Licensed ( http://www.apache.org/licenses/LICENSE-2.0 ) '遵循Apache2开源协议发布,并提供免费使用。 '-------------------------------------------------------- */ error_reporting(E_ERROR | E_PARSE ); @ini_set('max_execution_time', '0'); @ini_set("memory_limit",'-1'); $url = $_GET["url"]; if (!empty($url) && substr($url,0,4)=='http') { $dir = pathinfo($url); $host = $dir['dirname']; $ext = $dir['extension']; $refer = $host.'/'; $ch = curl_init($url); curl_setopt ($ch, CURLOPT_REFERER, $refer); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 15); curl_setopt($ch, CURLOPT_TIMEOUT, 30); curl_setopt($ch, CURLOPT_HEADER,0); curl_setopt($ch, CURLOPT_POST, 0); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 1); curl_setopt($ch, CURLOPT_BINARYTRANSFER, 1); $data = @curl_exec($ch); curl_close($ch); $types = array( 'gif'=>'image/gif', 'jpeg'=>'image/jpeg', 'jpg'=>'image/jpeg', 'jpe'=>'image/jpeg', 'png'=>'image/png', ); $type = $types[$ext] ? $types[$ext] : 'image/jpeg'; header("Content-type: ".$type); echo $data; }
步骤二
打开苹果CMS后台,系统 → 附件参数配置
1:反盗链标识:填写防盗图片链接中的统一标识,下面说几个例子,可以看到是域名后缀前方的字符串
腾讯的图片:http://puui.qpic.cn/(统一标识:qpic)
奇艺的图片:https://pic9.iqiyipic.com(统一标识:iqiyipic)
哔哩哔哩的图片:http://i0.hdslb.com/(统一标识:hdslb)
2:反盗链接口填写:/img.php?url=

方法二
在主题里找到include.html文件,一般在主题的/html/public/include.html,实际情况可以看主题的/html/index/index.html的head标签的调用
<head> {include file="seo/index"} {include file="public/include"} </head>
在include.html文件最上方加入下面代码
<meta name="referrer" content="always"> <meta name="referrer" content="no-referrer" />