gpt4 book ai didi

php - 如何在 PHP 中检测 w3.org 的机器人?

转载 作者:行者123 更新时间:2023-12-05 04:18:47 24 4
gpt4 key购买 nike

我想在 PHP 中检测 w3c 验证程序的机器人。因此,如果有人尝试在 http://validator.w3.org 上验证我的网站, 我想用 Php 做点别的事。

最佳答案

function w3c(){
if((stristr($_SERVER["HTTP_USER_AGENT"],'w3c') === TRUE))
return true;
}

if(w3c()){
// this is the w3c
}

如果你想对 w3c 验证器隐藏一些东西,只需使用:

if(!w3c()){
// this is not visible for the w3c validator
}

关于php - 如何在 PHP 中检测 w3.org 的机器人?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9411463/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com