详情页

帝国cms灵动标签调用正文三张图片,可设定调用数量。

时间:2024年06月01日

编辑:佚名

[e:loop={0,1,3,1}]
<divclass="yxsp_list_lf">
<ahref="<?=$bqsr['titleurl']?>"target="_blank">
<?php
$fr=$empire->fetch1("selectnewstextfrom{$dbtbpre}ecms_news_data_{$bqr[stb]}whereid='$bqr[id]'");//SQL查询正文内容
$str=stripcslashes($fr['newstext']);//正文内容脱敏
preg_match_all('/<img.*?src="(.*?)".*?>/is',$str,$imgArr);//正则
$imgArr=array_unique($imgArr[1]);//数组去重复
?>
<imgsrc="<?=$imgArr[0]?>"alt="<?=$bqr['title']?>">
<spanclass="txt_bj"></span>
<spanclass="txt"><?=$bqr['title']?></span>
<!--<spanclass="video_icon"></span>-->
</a>
</div>
[/e:loop]
说明:
调用多张图片,例如3张的话,如下写法:
<?=$imgArr[0]?> <?=$imgArr[1]?> <?=$imgArr[2]?>
相关文章
猜你需要