PHP判断网站的访问来源是否是蜘蛛
发表于:2022-01-27 14:55:52浏览:1754次
/** * 判断是否是蜘蛛 */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; }
栏目分类全部>
推荐文章
- mysql 更新json数据中文防止被转义
- Mysql用户权限配置
- 图片变形处理,可设置CSS属性object-fit: cover完美解决
- PHP中 empty() 和 isset() 的区别
- 解决composer install遇到:Your requirements could not be resolved to an installable set of packages
- Linux下对nginx日志进行统计分析的常用命令
- mysql定时备份数据库&定时删除多少天前的备份文件
- Linux下生成RSA非对称加密私钥与公钥的方法
- win10系统重装应用商店:安装路径不存在 该怎么办?
- 无限极分类设计其一