php Method for Generating Random Colors
- 2021-08-03 09:22:28
- OfStack
In this paper, an example is given to describe the method of generating random colors in php. Share it for your reference. The specific implementation method is as follows:
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;
}
I hope this article is helpful to everyone's PHP programming.