帝国CMS 用关键字做出Tags链接效果

思路:
1,帝国CMS的关键字一般是用英文逗号分隔,比如:小红,小明,小华
2,需要把英文逗号去掉,并且给每个关键字用html标签包起来,比如:<li>小红</li><li>小明</li><li>小华</li>

代码:

<?php 
$cr=$empire->fetch1("select classpagekey from {$dbtbpre}enewsclass where classid='$GLOBALS[navclassid]'");
$source=$cr[classpagekey];
$hello = explode(',',$source); 
for($index=0;$index<count($hello);$index++) 
{ 
echo "<li><a href='/e/tags/?tagname=$hello[$index]&tempid=8'>"; echo $hello[$index];echo "</a></li>"; 
} 
?>

.说明:
1,先把关键字内容取出来
2,用php的explode函数,把字符串打散为数组
3,然后用for循环,把数组中的每个词语用指定的HTML标签包起来