帝国cms自动提取内容第一张图片为标题图片代码

<?php
$sql=$empire->query("select * from {$dbtbpre}ecms_news order by onclick desc limit 1");
while($r=$empire->fetch($sql)){
$text=GetTxtFieldText($r[newstext]); //获取正文内容
$text1=substr($text,12);//去除exit
$datanr=stripslashes($text1); //册除反
$pattern ="/.*src=https://www.isolves.com/"([^^]*?)\".*/i"; //正则取图片
preg_match_all($pattern,$datanr,$matchess);
$diypic=$matchess[1][0]; //取第一张图片地址
?>
<img src=https://www.isolves.com/it/cxkf/ky/dg/2020-03-18/"">
<?}?>
【帝国cms自动提取内容第一张图片为标题图片代码】


    推荐阅读