### [织梦DEDECMS怎么调用文章TAG标签并加上链接](https://www.prosaas.cn/article/3021) **Published:** 2020-01-07T01:19:29 **Author:** 5201314 **Excerpt:** 织梦DEDECMS怎么调用文章TAG标签并加上链接?织梦DEDECMS调用文章TAG标签并加上链接的方法推荐学… ![](//zhiqipro.oss-cn-beijing.aliyuncs.com/2023/12/20231212121437281.jpg) **织梦DEDECMS怎么调用文章TAG标签并加上链接?** 织梦DEDECMS调用文章TAG标签并加上链接的方法 推荐学习:织梦cms 1.如果是列表页使用以下代码: \[field:id runphp='yes'\] global $cfg\_cmspath; $tags = GetTags(@me); $revalue = ''; $tags = explode(',', $tags); foreach($tags as $key => $value){ if($value){ $revalue .= ''.$value.' '; } } @me = $revalue; \[/field:id\] 2.如果是内容页使用以下代码: {dede:field.id runphp='yes'} global $cfg\_cmspath; $tags = GetTags(@me); $revalue = ''; $tags = explode(',', $tags); foreach($tags as $key => $value){ if($value){ $revalue .= ''.$value.', '; } } @me = $revalue; {/dede:field.id} 代码解释 其实这里就只是运用到了三个知识点: 1.使用自带的GetTags函数获取文档对应的TAG列表; 2.将获取到的值以半角符号的逗号(,)为标准拆分为数组; 3.循环数组元素,将其对应的值输出并加上链接; 同时呢,为了更好的兼容,这里也用 global $cfg\_cmspath;方法加载了系统基本参数里中的程序安装目录,用于在附加链接时自动兼容安装到子目录的站点。 以上就是织梦DEDECMS怎么调用文章TAG标签并加上链接的详细内容,更多请关注知企PROSAAS其它相关文章! **Tags:** DEDECMS, 循环 **Categories:** DEDECMS ---