给wordpress 增加干扰码防采集_PHP教程
打开 wp-includes下的post-template.php
先将代码加到 post-template.php 第一行
以下为引用的内容: function RndString($body) { //最大间隔距离(如果在检测不到p标记的情况下,加入混淆字串的最大间隔距离) $maxpos = 1024; //font 的字体颜色 $fontColor = “#FFFFFF”; //div span p 标记的随机样式 $st1 = chr(mt_rand(ord(”A”),ord(”Z”))).chr(mt_rand(ord(”a”),ord(”z”))).chr(mt_rand(ord(”a”),ord(”z”))).mt_rand(100,999); $st2 = chr(mt_rand(ord(”A”),ord(”Z”))).chr(mt_rand(ord(”a”),ord(”z”))).chr(mt_rand(ord(”a”),ord(”z”))).mt_rand(100,999); $st3 = chr(mt_rand(ord(”A”),ord(”Z”))).chr(mt_rand(ord(”a”),ord(”z”))).chr(mt_rand(ord(”a”),ord(”z”))).mt_rand(100,999); $st4 = chr(mt_rand(ord(”A”),ord(”Z”))).chr(mt_rand(ord(”a”),ord(”z”))).chr(mt_rand(ord(”a”),ord(”z”))).mt_rand(100,999); $rndstyle[1]["value"] = “.{$st1} { display:none; }”; $rndstyle[1]["name"] = $st1; $rndstyle[2]["value"] = “.{$st2} { display:none; }”; $rndstyle[2]["name"] = $st2; $rndstyle[3]["value"] = “.{$st3} { display:none; }”; $rndstyle[3]["name"] = $st3; $rndstyle[4]["value"] = “.{$st4} { display:none; }”; $rndstyle[4]["name"] = $st4; $mdd = mt_rand(1,4); //以后内容如果你不懂其含义,请不要改动 //————————————————— $rndstyleValue = $rndstyle[$mdd]["value"]; $rndstyleName = $rndstyle[$mdd]["name"]; $reString = “ “; //附机标记 $rndem[1] = “font”; $rndem[2] = “div”; $rndem[3] = “span”; $rndem[4] = “p”; //读取字符串数据 $fp = fopen(dirname(__FILE__).”/RndString.php”,”r”); $start = 0; $totalitem = 0; while(!feof($fp)){ $v = trim(fgets($fp,128)); if($start==1){ if(ereg(”#end#”,$v)) break; if($v!=”"{ $totalitem++; $rndstring[$totalitem] = ereg_replace(”#,”,”",$v); } } if(ereg(”#start#”,$v)){ $start = 1; } } fclose($fp); //处理要防采集的字段 $bodylen = strlen($body) - 1; $prepos = 0; for($i=0;$iif($i+2 >= $bodylen || $ielse{ @$ntag = strtolower($body[$i].$body[$i+1].$body[$i+2]); if($ntag==”” || ($ntag==” $maxpos) ){ $dd = mt_rand(1,4); $emname = $rndem[$dd]; $dd = mt_rand(1,$totalitem); $rnstr = $rndstring[$dd]; if($emname!=”font”) $rnstr = ” $rnstr$emname> “; else $rnstr = ” $rnstr “; $reString .= $rnstr.$body[$i]; $prepos = $i; } else $reString .= $body[$i]; } } unset($body); return $reString; }//函数结束 |
查找
以下为引用的内容: function the_content( |
将这段代码
以下为引用的内容: function the_content($more_link_text = “(more…)”, $stripteaser = 0, $more_file = “”) { $content = get_the_content($more_link_text, $stripteaser, $more_file); $content = apply_filters(”the_content”, $content); $content = str_replace(”]]>”, “]]>”, $content); echo $content; } |
改成
以下为引用的内容: function the_content($more_link_text = “(more…)”, $stripteaser = 0, $more_file = “”) { $content = get_the_content($more_link_text, $stripteaser, $more_file); $content = apply_filters(”the_content”, $content); $content = str_replace(”]]>”, “]]>”, $content); $content = RndString($content); echo $content; } |
注意,就多了行 $content = RndString($content);
上传附件中的RndString.php 文件到wp-includes/下
附件: 点这里下载
原文地址:http://www.mylb.net.cn/2008/08/608.html

热AI工具

Undresser.AI Undress
人工智能驱动的应用程序,用于创建逼真的裸体照片

AI Clothes Remover
用于从照片中去除衣服的在线人工智能工具。

Undress AI Tool
免费脱衣服图片

Clothoff.io
AI脱衣机

AI Hentai Generator
免费生成ai无尽的。

热门文章

热工具

记事本++7.3.1
好用且免费的代码编辑器

SublimeText3汉化版
中文版,非常好用

禅工作室 13.0.1
功能强大的PHP集成开发环境

Dreamweaver CS6
视觉化网页开发工具

SublimeText3 Mac版
神级代码编辑软件(SublimeText3)

热门话题

PHP和Flutter是移动端开发的流行技术。Flutter胜在跨平台能力、性能和用户界面,适合需要高性能、跨平台和自定义UI的应用程序。PHP则适用于性能较低、不跨平台的服务器端应用程序。

通过编辑 style.css 文件,您可以轻松修改 WordPress 页面宽度:编辑 style.css 文件,添加 .site-content { max-width: [您的首选宽度]; }。修改 [您的首选宽度] 以设置页面宽度。保存更改并清除缓存(可选)。

WordPress 文章存储在 /wp-content/uploads 文件夹中。该文件夹使用子文件夹对不同类型的上传进行分类,包括按年、月和文章 ID 组织的文章。文章文件以纯文本格式 (.txt) 存储,文件名通常包含其 ID 和标题。

WordPress 模板文件位于 /wp-content/themes/[主题名称]/ 目录。它们用于决定网站的外观和功能,包括页眉(header.php)、页脚(footer.php)、主模板(index.php)、单个文章(single.php)、页面(page.php)、存档(archive.php)、类别(category.php)、标签(tag.php)、搜索(search.php)和 404 错误页面(404.php)。通过编辑和修改这些文件,可以自定义 WordPress 网站的外

在 WordPress 中搜索作者:1. 登录管理面板后,导航到“文章”或“页面”,使用搜索栏输入作者姓名,在“过滤器”中选择“作者”。2. 其他技巧:使用通配符扩大搜索范围,使用运算符组合条件,或输入作者 ID 以搜索文章。

每当您下载某些文件或空投某些内容时,您的iPhone是否显示“iCloud存储空间已满”?iCloud储存空间的免费套餐限制为仅5GB。因此,您应该检查的第一件事是手机上iCloud的当前存储情况。如果仍有足够的存储空间,并且您收到通知,则这些解决方案将帮助您进行故障排除。修复1–删除iCloud备份从手机设置中移除现有版本的iCloud备份。步骤1–打开设置。步骤2–您将在“设置”面板的顶部找到您的AppleID。点击它以打开它。步骤3–打开“iCloud”以打开iCloud设置。步骤4–向下

最稳定的 WordPress 版本是最新版本,因为它包含最新的安全补丁、增强性能并引入新特性和改进。为了更新到最新版本,请登录 WordPress 仪表盘,转到“更新”页面并单击“立即更新”。

WordPress需要备案。根据我国《互联网安全管理办法》,在境内提供互联网信息服务的网站需向所在地省级互联网信息办公室备案,包括WordPress在内。备案流程包括选择服务商、准备信息、提交申请、审核公示、获取备案号等步骤。备案好处有合法合规、提升可信度、满足接入要求、确保正常访问等。备案信息需真实有效,备案后需定期更新。
