个人网站被刷,于是研究了一下百度统计,查了一些大佬的文章,在大佬的基础上拓展了下。
大佬文章原地址:https://www.daimadog.com/4502.html
本文拓展皆基于大佬文章,详细说明请看大佬文章,在此感谢大佬的解答,具体代码如下:
<?php
function visbd($bdid, $word, $entrance)
{
$bdjs = 'https://hm.baidu.com/hm.js?';
$bdgif = 'https://hm.baidu.com/hm.gif?';
//搜索引擎
$search = array(
'https://www.sogou.com/tx?query=',
'https://www.so.com/s?q=',
'https://www.google.com.hk/search?q=',
'https://cn.bing.com/search?q=');
$rand = rand(0, 3);
//随机一个搜索引擎
$hunt = $search["$rand"];
//必要的第一次传参
$params = ['si' => $bdid, 'su' => $hunt . urldecode($word), 'u' => $entrance . time()];
$url1 = $bdjs . $bdid;
getU