今天群里哥们分享的一段代码,根据蜘蛛判断,判断百度蜘蛛和360蜘蛛进行输出内容,屏蔽用户访问的代码,代码如下:
<?php if(!preg_match("/(baiduspider|360spider)/i", $_SERVER['HTTP_USER_AGENT'])) { header("HTTP/1.1 404 Not Found");exit; } ?>
比如我要在资讯模块进行屏蔽,只需要在根目录/article/show.php 加入即可
上一篇 nginx閮ㄧ讲django椤圭洰_uwsgi鍚姩django濂藉?
下一篇 python的hello world程序编写_python如何运行hello world?
版权所有 ©2023-2025 051e.com
ICP备案号:京ICP备12030808号