- <?php
- function randColor(){
- $letters = "1234567890ABCDEF";
- for($i=1;$i<6;$i++){
- $pos = rand(0,16);
- $str .= $string{$pos};
- }
- return "#".$str;
- }
- echo '<span style="color:'.randColor().'">Random Color Text</span>';
- ?>
来源: http://www.phpxs.com/code/1003312/