帝国cms插件 一键替换数据表中已发表文章的内容关键字

你是不是也在优化网站,是不是网站发展了一段时间之后才来做优化的,这样当然就会导致已经发表文章里的内容关键字,不能得到替换了!

小编根据后台替换内容关键字的程序,重写了一段 通过运行单个页面就能直接替换掉,在数据表中已发表文章的内容关键字, 这样,重新刷新文章就能批量的替换内容关键字了。

新建一个PHP文件,放到/e/action/ 目录下面就可以了。

<?php
require('../class/connect.php');
require('../class/db_sql.php');
require('../class/functions.php');
require('../class/t_functions.php');
require LoadLang('pub/fun.php');
require('../data/dbcache/class.php');
require('../data/dbcache/MemberLevel.php');
$link=db_connect();
$empire=new mysqlquery();
$tnum=100;
for ($i=0; $i<=$tnum; $i++)
{
    $sb=$empire->fetch1("select * from {$dbtbpre}ecms_news where id='".$i."' limit 1");
    $rr=$empire->fetch1("select * from {$dbtbpre}ecms_news_data_".$sb['stb']." where id='".$i."' limit 1");
    $zw=$rr[newstext];
    $xinwenzhang=ReplaceKey($zw,0);
    $empire->query("update {$dbtbpre}ecms_news_data_".$sb['stb']." set newstext='$xinwenzhang' where id='".$i."' limit 1");
}

?>

完毕,这么简单就能搞定,当然遇到中间ID断了,文章未审核,会出现中断的,可以根据tnum的数字来调节一下。比一个一个的改动还是省事多了啦!

猜你喜欢

转载自www.cnblogs.com/kuba8/p/12824841.html