Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/265.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何检测w3.org';PHP中的bot是什么?_Php_W3c_W3c Validation_Bots - Fatal编程技术网

如何检测w3.org';PHP中的bot是什么?

如何检测w3.org';PHP中的bot是什么?,php,w3c,w3c-validation,bots,Php,W3c,W3c Validation,Bots,我想在PHP中检测w3c验证程序的bot。因此,如果有人试图在上验证我的站点,我想用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 t

我想在PHP中检测w3c验证程序的bot。因此,如果有人试图在上验证我的站点,我想用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
}

这似乎是任何人都能做的最愚蠢的事情之一。如果你不在乎验证,那很酷。如果你真的在乎,那也很酷。如今,代码验证毫无用处——确保所有呈现引擎正确解析代码的结构是有用的,而验证则不是。截至2014年7月,我得到的完整用户代理字符串是“W3C_Validator/1.3”。