一、首先重新按需设置自动生成简介的字数,可以到“系统→系统参数设置→信息设置→信息简介截取”处更改,这里的数字,2个字符代表一个汉字,一个字符为一个英文。
二、写一个处理PHP,名字叫auto_smalltext.php,懒得写的,后面提供了下载地址了,直接下载使用也可以。
PHP的内容:
<?php
define('EmpireCMSAdmin','1');
require("../class/connect.php");
require("../class/db_sql.php");
require("../class/functions.php");
require("../class/t_functions.php");
require("../data/dbcache/class.php");
require("../data/language/gb/pub/fun.php");
$link=db_connect();
$empire=new mysqlquery();
$tbname='news';//数据表名称
$quantity=320;//重新生成简介字数:320代表320个英文,160个汉字!
$query="select * from {$dbtbpre}ecms_".$tbname." order by id desc";
$sql=$empire->query($query);
while($r=$empire->fetch($sql))
{
$rb=$empire->fetch1("select newstext from {$dbtbpre}ecms_".$tbname."_data_".$r[stb]." where id='".$r[id]."' limit 1");
$newstext=$rb[newstext];
$smalltext=strip_tags($newstext);
$smalltext=esub($smalltext,$quantity);
$empire->query("update {$dbtbpre}ecms_".$tbname." set smalltext='$smalltext' where id='$r[id]'");
}
echo '执行完毕';
db_close();
$empire=null;
?>
把PHP放到/e/extend/ 目录下!
三、按需调整PHP文件里的数据表名字和简介字数。
四、备份你的数据库,防止出错.
五、浏览器运行 你的域名/e/extend/auto_smalltext.php
完成!
声明:本站所有文章,如无特殊说明或标注,均为本站原创发布。任何个人或组织,在未征得本站同意时,禁止复制、盗用、采集、发布本站内容到任何网站、书籍等各类媒体平台。如若本站内容侵犯了原著者的合法权益,可联系我们进行处理。