帝国cms首页调用输出多张图片,经测试,多张图输出多张图,单张图输出单张图的板块。
[e:loop={'news',10,18,1}]
<?php
$fr=$empire->fetch1("select newstext from {$dbtbpre}ecms_news_data_{$bqr[stb]} where id='$bqr[id]'");
$str=stripcslashes($fr['newstext']);
preg_match_all('/<img.*?src="(.*?)".*?>/is',$str,$imgArr);
$imgArr = array_unique($imgArr[1]);
?>
<?=count($imgArr)?>张
<?php
for($i=0;$i<count($imgArr);$i++){
echo '<img src="'.$imgArr[$i].'" width="200" height="200" />';
}
?>
<a href="<?=$bqsr['titleurl']?>" title=“<?=$bqr['title']?>”><?=$bqr['title']?></a>
[/e:loop]
帝国CMS内容页列表页怎么调用多张图片显示两个地方需要考虑
1. newstext字段是不是在副表?
2. 要对newstext字段脱敏 stripcslashes($bqr['newstext'])
当前目录:帝国CMS教程
帝国cms首页调用输出多张图片,经测试,多张图输出多张图,单张图输出单张图的板块。
帝国CMS教程 2025-04-03 15:31:00