用法:后台增加自定义页面添加下面PHP代码
$sql=$empire->query("select title,id from {$dbtbpre}ecms_news where id>0");
while ($row=$empire->fetch($sql)) {
$tou=mb_substr($row[title],0,1,'utf-8'); //获取标题头一个字
//$wei=mb_substr($row[title],mb_strlen($str,'utf-8')-1,1,'utf-8'); //获取标题最后一个字
$empire->fetch1("update {$dbtbpre}ecms_news set tou = '$tou' where id = $row[id]");
echo $row['id'];
}
效果图: