PHP判断网站的访问来源是否是蜘蛛
发表于:2022-01-27 14:55:52浏览:2370次
/**
* 判断是否是蜘蛛
*/function fromRobot($except = '') {
$ua = strtolower ( $_SERVER ['HTTP_USER_AGENT'] );
$botchar = "/(baidu|google|spider|soso|yahoo|sohu-search|yodao|robozilla|AhrefsBot)/i";
$except ? $botchar = str_replace ( $except . '|', '', $botchar ) : '';
if (preg_match ( $botchar, $ua )) {
return true;
}
return false;
}栏目分类全部>
推荐文章
- TP6便捷快速查询日、月、年数据的方法
- Linux 判断文件是否存在的shell脚本代码
- mysql 更新json数据中文防止被转义
- PHP依据用户当前定位的经纬度判断距离最近的门店
- Linux相关知识点汇集
- 重置WSL ubuntu 20 root 密码
- MYSQL 替换字段值中一部分替换再拼接剩余部分
- Linux小技巧之:两种方法统计访问web网站的前10个IP
- mysql按条件统计count,及关联查询显示count为0的记录问题
- 解决composer install遇到:Your requirements could not be resolved to an installable set of packages
