几个实用的php生成随机颜色函数

php 生成随机颜色
1
function rand_color(){
$str=’0123456789ABCDEF’;
$estr=’#’;
$len=strlen($str);
for($i=1;$i< =6;$i++) { $num=rand(0,$len-1); $estr=$estr.$str[$num]; } return $estr; } 2 function mbw_color(){ $s = '#'; $c = array('26a2b6','0085c6','51A351','f0bf4a','ff5c00','bd362f','b9298f','c9c','00b5ad','ff8edf','f00','076FBD','449f04','EE6E33','8F36B1','6cc','6c9','f96'); shuffle($c); foreach($c as $v) { return $s.= $v; } } //自定义固定的颜色在随机 3 //数组