查看: 3189|回复: 0

帝国CMS批量提取正文内容到smalltext简介(php smalltext)

[复制链接]

610

主题

413

回帖

77

日志

管理员

积分
5359
QQ
发表于 2022-10-11 22:28:52 | 显示全部楼层 |阅读模式
帝国CMS批量提取正文内容到smalltext简介(php smalltext)代码:

使用方法:

1、先备份数据库

2、以下代码保存到:/e/admin/ChangeSmallText.php

注意:$tbname="news";修改为要提取的模型;($r['newstext'],200);修改为要提取smalltext的长度

3、浏览器访问:/e/admin/ChangeSmallText.php

/e/admin/changesmalltext.php?startid=2516 修改为要提取smalltext的开始ID


  1. <?php
  2. define('EmpireCMSAdmin','1');
  3. require("../class/connect.php");
  4. require("../class/db_sql.php");
  5. require("../class/functions.php");
  6. require LoadLang("pub/fun.php");
  7. require("../class/t_functions.php");
  8. require("../data/dbcache/class.php");
  9. require("../data/dbcache/MemberLevel.php");
  10. $link=db_connect();
  11. $empire=new mysqlquery();
  12. $tbname="news";
  13. $sid=(int)$_GET['startid'];
  14. $b=0;
  15. $rs=$empire->query("SELECT id,newstext FROM {$dbtbpre}ecms_{$tbname}_data_1 WHERE id>{$sid} limit 20");
  16. while($r=$empire->fetch($rs))
  17. {
  18. $smalltext='';
  19. !$r['newstext'] or $smalltext=SubSmalltextVal($r['newstext'],200);
  20. $smalltext=addslashes($smalltext);
  21. $smalltext &&
  22. $empire->query("UPDATE {$dbtbpre}ecms_{$tbname} SET smalltext='{$smalltext}' WHERE id=".$r[id]);
  23. $b=$r['id'];
  24. }
  25. $b or exit('转换结束!');
复制代码
  1. echo "<meta http-equiv="refresh" content="1;url=changesmalltext.php?startid=".$b."">";
  2. echo "已转换ID".$b;
  3. db_close();
  4. $empire=null;
  5. ?>
复制代码

上士闻道,勤而行之;中士闻道,若存若亡;下士闻道,大笑之。不笑不足以为道!
回复 关闭延时

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册  

本版积分规则

快速回复 返回顶部 返回列表