一段php生成随机颜色的代码,如:FF00FF function random_color(){ mt_srand((double)microtime()*1000000); $c = ''; while(strlen($c)<6){ $c .= sprintf("X", mt_rand(0, 255)); } return $c;} //使用范例:random_color() => returns something like: '7C42BA', '5F3964' 复制代码 PHP