$rnd = Array('0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f');
$rnd_color = "#";
for ($i=0; $i<6; $i++) {
$rnd_color .= $rnd[rand(0,15)];
}
Reference: Random Hex Color
Android | Web Programming | 網站程式設計 | HTML | CSS | JavaScript | PHP
Andro Chen 陳俊安的程式重點速記
$rnd = Array('0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f');
$rnd_color = "#";
for ($i=0; $i<6; $i++) {
$rnd_color .= $rnd[rand(0,15)];
}
沒有留言 :
張貼留言