帝国cms使用sql调用随机tags标签

调用代码:

[e:loop={'select * from phome_enewstags order by rand() limit 1',32,24,0}]
<li><a href="/zt/<?=$bqr['tagid']?>/"><?=$bqr['tagname']?></a></li>
[/e:loop]

伪静态

rewrite ^(.*)/zt/(.+?)$ $1/e/tags/?tagid=$2;

 

拓展

[e:loop={'select * from phome_enewstags order by rand() limit 100',32,24,0}]
<?php
$str = ['zt','list','newss','shishi'];
for ($x=0; $x<=100; $x++) {
    $i = array_rand($str);
    //echo $str[$i]."<br/>";
} 
?>
<li><a href="<?=$str[$i]?>/<?=$bqr['tagid']?>/"><?=$bqr['tagname']?></a></li>
[/e:loop]

 

posted @ 2021-05-11 10:00  secsafe  阅读(333)  评论(0编辑  收藏  举报