一、详细介绍
php调至7.3
设置伪静态为thinkphp
设置网站运行目录为public
编辑根目录下的.env文件配置数据库信息
详细教程请看源码内置说明文本!
亲测截图!真实有效!
二、效果展示
1.部分代码
代码如下(示例):
//回滚
$siteurl = (getenv("SERVER_PORT") == 443 ? "https://" : "http://") . getenv("HTTP_HOST") . getenv("PHP_SELF");
if (ROLLBACK == 1) file_get_contents($siteurl);
//随机IP
function mkip() {
$ip_long = array(
array("607649792", "608174079"),
array("1038614528", "1039007743"),
array("1783627776", "1784676351"),
array("2035023872", "2035154943"),
array("2078801920", "2079064063"),
array("-1950089216", "-1948778497"),
array("-1425539072", "-1425014785"),
array("-1236271104", "-1235419137"),
array("-770113536", "-768606209"),
array("-569376768", "-564133889")
);
$rand_key = mt_rand(0, 9);
return $ip = long2ip(mt_rand($ip_long[$rand_key][0], $ip_long[$rand_key][1]));
}
//抓取请求
function Curl($url, $post = false, $cookie = false, $addheader = false) {
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
if (RANDIP == 1) {
$ip = mkip();
$httpheader[] = "CLIENT-IP:$ip";
$httpheader[] = "X-FORWARDED-FOR:$ip";
$httpheader[] = "REMOTE-ADDR:$ip";
$httpheader[] = "HTTP-CLIENT-IP:$ip";
if (!empty($addheader)) $httpheader = array_merge($httpheader, $addheader);
curl_setopt($ch, CURLOPT_HTTPHEADER, $httpheader);
}
if (!empty($post)) {
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post);
}
if (!empty($cookie)) {
curl_setopt($ch, CURLOPT_COOKIE, $cookie);
}
curl_setopt($ch, CURLOPT_USERAGENT, "LangShen");
curl_setopt($ch, CURLOPT_TIMEOUT, 1);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, false);
curl_setopt($ch, CURLOPT_FORBID_REUSE, true);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 1);
curl_setopt($ch, CURLOPT_DNS_CACHE_TIMEOUT, 10);
curl_setopt($ch, CURLOPT_FRESH_CONNECT, true);
$ret = curl_exec($ch);
curl_close($ch);
return $ret;
}