dedecms织梦 softlinks php循环匹配问题 --已知 [field:softlinks/]标签可调出如下数据:
{dede:link text='网址名1'} http://网址1 {/dede:link}
{dede:link text='网址名2'} http://网址2 {/dede:link}
...
{dede:link text='网址名n'} http://网址n {/dede:link}
------------想要显示的内容:
<a href="http://网址1" title="网址名1"><img src="http://网址1.png" width="18" height="18" alt="网址名1"></a>
<a href="http://网址2" title="网址名2"><img src="http://网址2.png" width="18" height="18" alt="网址名2"></a>
...
<a href="http://网址n" title="网址名n"><img src="http://网址n.png" width="18" height="18" alt="网址名n"></a>
-----------参考代码
代码写法如下:
[field:softlinks runphp='yes']
preg_match_all('/=\'(.+?)\'} (.+?) {/sim', @me, $strResult, PREG_PATTERN_ORDER);
$aaa=array();
for($p=0;$p<count($strResult[0]);$p++){
$aaa[]='<a class=tooltip href='.$strResult[2][$p].' title='.$strResult[1][$p].'><img src='.$strResult[2][$p].'.png width=18 height=18 alt='.$strResult[1][$p].'></a>';
}
$aaa=implode('',$aaa);
@me=$aaa;
[/field:softlinks]
2、本站永久网址:https://www.yuanmacun.com
3、本网站的文章部分内容可能来源于网络,仅供大家学习与参考,如有侵权,请联系站长进行删除处理。
4、本站一切资源不代表本站立场,并不代表本站赞同其观点和对其真实性负责。
5、本站一律禁止以任何方式发布或转载任何违法的相关信息,访客发现请向站长举报
6、本站资源大多存储在云盘,如发现链接失效,请联系我们我们会第一时间更新。
源码村资源网 » dede softlinks php循环匹配问题