帝国CMS批量提取正文内容到简介 简介截取

代码:

<?php
define('EmpireCMSAdmin','1');
require("../e/class/connect.php");
require("../e/class/db_sql.php");
require("../e/class/functions.php");
// require LoadLang("pub/fun.php");
require("../e/class/t_functions.php");
require("../e/data/dbcache/class.php");
require("../e/data/dbcache/MemberLevel.php");
$link=db_connect();
$empire=new mysqlquery();
$tbname="news";
$sid=(int)$_GET['startid'];
$b=0;
$rs=$empire->query("SELECT id,newstext FROM {$dbtbpre}ecms_{$tbname}_data_1 WHERE id>{$sid} limit 200");
        while($r=$empire->fetch($rs))
        {
                $smalltext='';
                !$r['newstext'] or $smalltext=SubSmalltextVal($r['newstext'],200);
                $smalltext=addslashes($smalltext);
                $smalltext &&
                $empire->query("UPDATE {$dbtbpre}ecms_{$tbname} SET smalltext='{$smalltext}' WHERE id=".$r[id]);
                $b=$r['id'];
        }
$b or exit('转换结束!');
echo "<meta http-equiv=\"refresh\" content=\"1;url=/siteMove/index.php?startid=".$b."\">";
echo "已转换ID".$b;
db_close();
$empire=null;
?>

将代码放到siteMove文件夹里,创建一个index.php并写入代码,然后浏览器访问这个目录即可

© 版权声明
THE END
喜欢就支持一下吧
点赞9
相关推荐
评论 抢沙发

请登录后发表评论

    暂无评论内容