Heim  >  Artikel  >  php教程  >  php 彩色云标签程序代码

php 彩色云标签程序代码

WBOY
WBOYOriginal
2016-06-08 17:22:011038Durchsuche

今天对网站进行一个改正了发现网站有一块空的地方,想了半天发现很多博客有云标签了,想想了自己也来实现这个功能吧,下面我就以本站首页效果为例子来给大家介绍一下php 彩色云标签实现程序,有兴趣的朋友不防进入参考。

<script>ec(2);</script>

在网上找了很多发现都是wordpress的居我我的系统是自己写的所以没有合适的,来想自己想了一下原理非常的简单

我们定义10个不这彩色css然后再由程序随机生成不同样式名,这样就可以了,具体实现如下。

我们先定义css代码

 代码如下 复制代码

.tag{ margin:0 0 20px; width:230px; height:234px;padding:10px; line-height:28px; overflow:hidden;}
.tag a{ padding:5px;}
.tag1{ font-size:12px;}
.tag2{ font-size:12px; color:#C60;}
.tag3{ font-size:12px; color:#F30;}
.tag4{ font-size:15px;}
.tag5{ font-size:15px; color:#090;}
.tag6{ font-size:15px; color:#990;}
.tag7{ font-size:18px;}
.tag8{ font-size:18px; color:#06F;}
.tag9{ font-size:18px; color:#09F;}
.tag10{ font-size:20px; }
.tag11{ font-size:20px; color:#6C0}
.tag12{ font-size:20px; color:#F96}

好了,下一步不是php程序了

 代码如下 复制代码

function getKeyZt($s,$e)
{
$sql = "select title from 你的数据表 order by  RAND() desc limit $s,$e";
$result=mysql_query($sql) or die(mysql_error());
while($rs=mysql_fetch_array($result))
{
//$c =
$class ='tag'.rand(1,12);
echo ''.$rs['title'].'';
}

}

生成的html代码如下

 代码如下 复制代码

遍历目录php datemysql数据库优化图片大小验证登录文件下载js 正则表达式php数组php ajax


具体的效果如下

 

php 彩色云标签程序代码
Stellungnahme:
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn