好!欢迎访问迷津渡口 现在时间是: 天气 °C ~ °C

迷津渡口

越感到迷惑 越接近真理

php获取随机颜色

有时我们需要随机的颜色,如本站的标签背景色,小指分享两种方法。

方法一:完全随机的颜色

<?php
function randColor(){
    $colors = array();
    for($i = 0;$i<6;$i++){
        $colors[] = dechex(rand(0,15));
    }
    return implode('',$colors);
}
?>

使用颜色的方法:

<?php echo '<span style="color: #'.randColor().'">随机颜色:#'.randColor().'</span>';?>

方法二:随机挑选数组里的颜色

<?php
function randColor(){
    $colors=array('5CB85C','428BCA','FF6600','D9534F','B37333','00ABA9');
    $show_color = array_rand($colors, 1);
    return $colors[$show_color];
}
?>

使用颜色的方法是一样的,但是只会是你设置的数组里面的颜色:

<?php echo '<span style="color: #'.randColor().'">随机颜色:#'.randColor().'</span>';?>


需要的自己试试吧~

点赞1
 标签: php获取随机颜色
   支持一下
挤眼 亲亲 咆哮 开心 想想 可怜 糗大了 委屈 哈哈 小声点 右哼哼 左哼哼 疑问 坏笑 赚钱啦 悲伤 耍酷 勾引 厉害 握手 耶 嘻嘻 害羞 鼓掌 馋嘴 抓狂 抱抱 围观 威武 给力
 点赞
 签到
 表情
 图片
 代码
提交评论

清空信息
关闭评论
websiteopmaat
 websiteopmaat 2019-05-21 06:01回复
#220
<a href="http://www.setusoftware.com/asics-onitsuka-tiger-mexico-66-grigio-blu-scarpei">asics onitsuka tiger mexico 66 grigio blu</a> <a href="http://www.shopteamcubs.com/mujeres-gris-slip-on-converse-zapatosh">mujeres gris slip on converse</a> <a href="http://www.danieldavinci.com/adidas-tubular-defiant-halo-lyser%C3%B8d-skok">adidas tubular defiant halo lyser酶d</a> <a href="http://www.lovirani.com/kvinner-nike-free-flyknit-5.0-v2-lilla-svart-obuvi">kvinner nike free flyknit 5.0 v2 lilla svart</a> <a href="http://www.rosebites.com/nike-internationalist-light-rosado-nail-zapatosl">nike internationalist light rosado nail</a> <a href="http://www.webrushllc.com/oakley-antix-sunglasses-white-frame-gray-lens-sunglassesh">oakley antix sunglasses white frame gray lens</a>
websiteopmaat http://www.websiteopmaat.com/
eczacinim
 eczacinim 2019-05-21 01:06回复
#219
<a href="http://www.shiftcampus.com/russell-westbrook-jersey-youth-large-nfli">russell westbrook jersey youth large</a> <a href="http://www.fiestanetwork.com/nike-zoom-structure-19-gr%C3%A5-r%C3%B8d-skoq">nike zoom structure 19 gr氓 r酶d</a> <a href="http://www.sunbeltsaves.com/ralph-lauren-rugby-shorts-poloh">ralph lauren rugby shorts</a> <a href="http://www.drmastella.com/air-jordan-retro-14-yellow-pink-shoesi">air jordan retro 14 yellow pink</a> <a href="http://www.khzrubber.com/womens-air-max-90-em-pink-white-shoesk">womens air max 90 em pink white</a> <a href="http://www.jkdeskisehir.com/nike-free-og-14-woven-off-hvit-obuvq">nike free og 14 woven off hvit</a>
eczacinim http://www.eczacinim.com/
onlysidekick
 onlysidekick 2019-05-20 16:52回复
#218
<a href="http://www.profancyshop.com/mennns-asics-gel-lyte-5-gr%C3%B8nn-rosa-obuvj">mennns asics gel lyte 5 gr酶nn rosa</a> <a href="http://www.lmcgroep.com/femminile-nike-roshe-run-floreale-gituttio-blu-scarpep">femminile nike roshe run floreale gituttio blu</a> <a href="http://www.nowaitnails.com/nike-kobe-11-femmes-rouge-bleu-ciel-chaussuresh">nike kobe 11 femmes rouge bleu ciel</a> <a href="http://www.xmrujo.com/prada-mini-saffiano-camera-crossbody-bag-pradah">prada mini saffiano camera crossbody bag</a> <a href="http://www.sevenguard.com/buster-posey-orange-jersey-nfli">buster posey orange jersey</a> <a href="http://www.escortsue.com/nike-air-max-ltd-wolf-gr%C3%A5-hvid-skoq">nike air max ltd wolf gr氓 hvid</a>
onlysidekick http://www.onlysidekick.com/
kd 8 marine bleu
 kd 8 marine bleu 2019-05-20 12:20回复
#217
<a href="http://www.unefinemouche.com/kvinners-nike-air-max-1-svart-bl%C3%A5-obuvk">kvinners nike air max 1 svart bl氓</a> <a href="http://www.ayuinc.com/mens-asics-asics-gel-kinsei-2-pink-gold-shoesi">mens asics asics gel kinsei 2 pink gold</a> <a href="http://www.unirlisboa.com/nike-air-max-zero-kvinders-guld-lyser%C3%B8d-skoj">nike air max zero kvinders guld lyser酶d</a> <a href="http://www.escortfeeds.com/nike-roshe-run-hyperfuse-oransje-obuvi">nike roshe run hyperfuse oransje</a> <a href="http://www.rdjanitorial.com/mennns-asics-asics-gel-kayano-20-gul-obuvk">mennns asics asics gel kayano 20 gul</a> <a href="http://www.bookoobeats.com/air-jordan-8-gull-hvit-obuvi">air jordan 8 gull hvit</a>
kd 8 marine bleu http://www.blovese.com/kd-8-marine-bleu-chaussuresq
njdevsblog
 njdevsblog 2019-05-20 08:12回复
#216
<a href="http://www.bowtieorg.com/ralph-lauren-slim-fit-chino-shorts-poloh">ralph lauren slim fit chino shorts</a> <a href="http://www.shaneboothmx.com/nike-air-huarache-pink-and-blue-shoesi">nike air huarache pink and blue</a> <a href="http://www.basarancarpet.com/adidas-15.1-fg-bianca-gituttio-scarpej">adidas 15.1 fg bianca gituttio</a> <a href="http://www.freedhamaal.com/adidas-superstar-classic-wei%C3%9F-hologram-iridescent-schuhej">adidas superstar classic wei脽 hologram iridescent</a> <a href="http://www.borbonecoffe.com/washington-nationals-toddler-hat-hath">washington nationals toddler hat</a> <a href="http://www.cammaara.com/hommes-nike-zoom-kobe-9-or-gris-noir-chaussuresh">hommes nike zoom kobe 9 or gris noir</a>
njdevsblog http://www.njdevsblog.com/
sevenguard
 sevenguard 2019-05-20 05:45回复
#215
<a href="http://www.mwartsdrama.com/womens-nike-shox-turbo-21-yellow-white-shoesk">womens nike shox turbo 21 yellow white</a> <a href="http://www.meshmotors.com/kvinners-nike-zoom-structure-18-r%C3%B8d-gr%C3%A5-obuvq">kvinners nike zoom structure 18 r酶d gr氓</a> <a href="http://www.aspenmedisys.com/nike-air-huarache-kvinders-gr%C3%A5-lyser%C3%B8d-skoj">nike air huarache kvinders gr氓 lyser酶d</a> <a href="http://www.smartiesland.com/nike-roshe-run-femminile-mesh-44-burgundy-bianca-scarpeq">nike roshe run femminile mesh 44 burgundy bianca</a> <a href="http://www.emcetolerie.com/womens-asics-gel-noosa-tri-8-grey-blue-shoesj">womens asics gel noosa tri 8 grey blue</a> <a href="http://www.lapaktoko.com/kvinders-nike-sb-stefan-janoski-max-lilla-gul-skop">kvinders nike sb stefan janoski max lilla gul</a>
sevenguard http://www.sevenguard.com/
karmicfix
 karmicfix 2019-05-19 17:44回复
#214
<a href="http://www.beautymotive.com/memphis-grizzlies-new-era-nba-kids-black-white-59fifty-cap-hatk">memphis grizzlies new era nba kids black white 59fifty cap</a> <a href="http://www.poleblacks.com/nike-m%C3%A6nd-roshe-wool-skin-army-gr%C3%B8n-rabat-skoj">nike m忙nd roshe wool skin army gr酶n rabat</a> <a href="http://www.qiefun.com/ralph-lauren-rugby-club-poloh">ralph lauren rugby club</a> <a href="http://www.kickums.com/adidas-predator-sl-trx-fg-shoesi">adidas predator sl trx fg</a> <a href="http://www.rahndfvd.com/maschio-supra-vaider-grigio-nero-scarpej">maschio supra vaider grigio nero</a> <a href="http://www.followjacker.com/triple-schwarz-covers-the-nike-free-inneva-woven-2-schuhej">triple schwarz covers the nike free inneva woven 2</a>
karmicfix http://www.karmicfix.com/
yeliseeva
 yeliseeva 2019-05-19 06:57回复
#213
<a href="http://www.mwartsdrama.com/nike-air-max-lunar-90-azul-oro-zapatosk">nike air max lunar 90 azul oro</a> <a href="http://www.meshmotors.com/air-jordan-retro-6-gris-amarillo-zapatosp">air jordan retro 6 gris amarillo</a> <a href="http://www.aspenmedisys.com/the-north-face-apex-bionic-jacket-for-ladies-northfaceh">the north face apex bionic jacket for ladies</a> <a href="http://www.smartiesland.com/air-jordan-retro-9-lila-himmelblau-schuhej">air jordan retro 9 lila himmelblau</a> <a href="http://www.emcetolerie.com/air-jordan-jumpman-gr%C3%A5-r%C3%B8d-skoh">air jordan jumpman gr氓 r酶d</a> <a href="http://www.lapaktoko.com/femmes-nike-kobe-9-jaune-noir-chaussuresh">femmes nike kobe 9 jaune noir</a>
yeliseeva http://www.yeliseeva.com/
rcrocs
 rcrocs 2019-05-18 19:25回复
#212
<a href="http://www.seesoshow.com/ladies-drew-brees-jersey-nfli">ladies drew brees jersey</a> <a href="http://www.crypolio.com/curry-3-negro-zapatosh">curry 3 negro</a> <a href="http://www.vtrvideo.com/classic-nike-cortez-blanco-cuero-armada-azul-gym-zapatosk">classic nike cortez blanco cuero armada azul gym</a> <a href="http://www.asoseinhalb.com/the-north-face-womens-apex-bionic-2-northfaceh">the north face womens apex bionic 2</a> <a href="http://www.handydgh.com/zoom-pegasus-33-rot-schuhek">zoom pegasus 33 rot</a> <a href="http://www.blakefanz.com/jordan-superfly-2-carolina-bl%C3%A5-skoi">jordan superfly 2 carolina bl氓</a>
rcrocs http://www.rcrocs.com/
timowallets
 timowallets 2019-05-18 18:13回复
#211
<a href="http://www.awassessment.com/nike-free-azul-zapatos-zapatosk">nike free azul zapatos</a> <a href="http://www.websiteopmaat.com/the-north-face-resolve-jacket-review-northfaceh">the north face resolve jacket review</a> <a href="http://www.lopifitfl.com/adidas-tubular-viral-w-triple-schwarz-schuhek">adidas tubular viral w triple schwarz</a> <a href="http://www.aurorefleurs.com/nike-zoom-alle-out-gr%C3%A5-gr%C3%B8n-skoi">nike zoom alle out gr氓 gr酶n</a> <a href="http://www.ezedcal.com/adidas-trx-trainers-bleu-jaune-chaussuresh">adidas trx trainers bleu jaune</a> <a href="http://www.calsportswear.com/st.-louis-cardinals-47-mlb-on-field-replica-47-clean-up-cap-hatl">st. louis cardinals 47 mlb on field replica 47 clean up cap</a>
[url=http://www.timowallets.com/]timowallets[/url]
顶部留言底部
 00:00/00:00
我想和你虚度时光 - 花房姑娘(9)
  1. 我想和你虚度时光
  2. 花房姑娘
  3. 恋恋风尘
  4. 我喜爱一切不彻底的事物
  5. 我的心里是满的
  6. Long Way
  7. 给少年的歌
  8. 晴日共剪窗
  9. 天上的月你的脸