Customize your theme in the Theme Customizer panel. See changes live without page reloading.   

WordPress实现自动记录死链地址提交

当前位置:
估计的阅读时间: < 1分钟
<?php
//死链提交,WordPress实现自动记录死链地址,添加到WordPress主题中的404.php页面中。
//通过代码已经实现了死链记录,那么我们就还需要如上图在百度站长平台的死链提交“你的域名/badlink.txt”即可全部完成。
if(is_404 && strpos($_SERVER['HTTP_USER_AGENT'],'Baiduspider') !== false){
$fp    =    fopen("badlink.txt","a");//badlink.txt就是在网站根目录的记录死链的文件
flock    ($fp, LOCK_EX) ;
fwrite    ($fp, home_url($_SERVER['REQUEST_URI'])."n");
flock    ($fp, LOCK_UN);
fclose    ($fp);
}
?>
这篇文章有帮助吗?
浏览: 2
Call to action title here