<?php //判断内容页是否百度收录 function baidu($url){ $url='http://www.baidu.com/s?wd='.$url; $curl=curl_init(); curl_setopt($curl,CURLOPT_URL,$url); curl_setopt($curl,CURLOPT_RETURNTRANSFER,1); $rs=curl_exec($curl); curl_close($curl); if(!strpos($rs,'没有找到')){ return 1; }else{ return 0; } } function logurl($logid){ $url=Url::log($logid); if(baidu($url)==1){ echo "百度已收录"; }else{ echo "<a style=\"color:red;\" rel=\"external nofollow\" title=\"点击提交收录!\" target=\"_blank\" href=\"http://zhanzhang.baidu.com/sitesubmit/index?sitename=$url\">百度未收录</a>"; } } ?>
echo_log.php或page.php中调用:
<?php logurl($logid);?>
有朋自远方来...评论一下呗O(∩_∩)O