DEDE 清理少于50个字节的文章
先在数据库里查询,数据库里有多少篇这样的文章
SELECT aid FROM dede_addonarticle WHERE LENGTH(body)<50;
效果图:
<meta charset="utf-8"> <?php $host = '127.0.0.1'; $user = 'root'; $pwd = '123456'; $name = 'dede'; @$mysqli = new mysqli($host,$user,$pwd,$name); if (mysqli_connect_errno ()) { echo '数据库连接出现了错误'; exit (); } $mysqli->set_charset ('utf8'); $sql = "SELECT aid FROM dede_addonarticle WHERE LENGTH(body)<50"; $result = $mysqli->query($sql); $arr = array(); $i = 0; while (!!$row = $result->fetch_row()) { $arr[$i]=$row[0]; $i++; } //print_r($arr); $str=""; $str2=""; for($i=0;$i<count($arr);$i++){ if($i===(count($arr)-1)){ $str.= "aid = $arr[$i]"; $str2.= "id = $arr[$i]"; }else{ $str.= "aid = $arr[$i] OR "; $str2.= "id = $arr[$i] OR "; } } echo 'DELETE FROM dede_addonarticle WHERE '.$str.';'; echo '<br>'; echo 'DELETE FROM dede_arctiny WHERE '.$str2.';'; echo '<br>'; echo 'DELETE FROM dede_archives WHERE '.$str2.';'; $mysqli->close(); ?>
效果图:
然后把这些语句执行,效果图:
相关推荐
mbcsdn 2020-05-25
yfisaboy 2020-05-16
IT前沿 2020-04-25
vavid 2010-11-17
Sincelily 2013-06-25
seo研究小屋 2014-01-09
徐汇业大信息中心 2012-08-11
AnyBisks 2011-12-15
86407413 2015-12-21
baoLidanyang 2010-05-25
zhangwei0php 2019-04-10
PHP100 2019-03-27
PHP100 2019-03-27
PHP100 2019-03-27
PHP100 2019-03-27
PHP100 2019-03-27