内容简介字段重新生成。 把文件保存至PHP,存放到e/extend/smalltext/index.php运行即可。
<?php require('../../class/connect.php'); //引入数据库配置文件和公共函数文件 require('../../class/db_sql.php'); //引入数据库操作文件 require('../../data/dbcache/class.php'); //引入栏目缓存文件 $link=db_connect(); //连接MYSQL $empire=new mysqlquery(); //声明数据库操作类 $editor=1; //声明目录层次 function DeleteHtml($str) { $str = str_replace(" ","",$str); $str = str_replace("\t","",$str); $str = str_replace("\r\n","",$str); $str = str_replace("\r","",$str); $str = str_replace("\n","",$str); $str = str_replace(" ","",$str); $str = str_replace("“","",$str); $str = str_replace("”","",$str); $str = str_replace("&","",$str); $str = str_replace("middot;","",$str); $str = str_replace("—","",$str); $str = str_replace(" ","",$str); return trim($str); }
$mysql=$empire->query("select id,newstext from {$dbtbpre}ecms_news_data_1 order by id asc"); while($r=$empire->fetch($mysql)) //循环获取查询记录 { $news=strip_tags(stripslashes($r['newstext'])); $news=DeleteHtml($news); $news=esub($news,255); $sql = $empire->query("update {$dbtbpre}ecms_news set smalltext='{$news}' where id='{$r[id]}'"); } ?> <?php db_close(); //关闭MYSQL链接 $empire=null; //注消操作类变量 ?>
上传以下图片:
|