This article introduces to students an example of generating random color codes in PHP. Friends who need to learn more can refer to it.
代码如下 |
复制代码 |
function randrgb()
{
$str='0123456789ABCDEF';
$estr='#';
$len=strlen($str);
for($i=1;$i<=6;$i++)
{
$num=rand(0,$len-1);
$estr=$estr.$str[$num];
}
return $estr;
} |
http://www.bkjia.com/PHPjc/631251.htmlwww.bkjia.comtruehttp: //www.bkjia.com/PHPjc/631251.htmlTechArticleThis article introduces to students an example of generating random color codes in PHP. Friends who need to learn more can refer to it. The code is as follows Copy code function randrgb() { $str='0123456789ABCDEF';...