给定可用的字符列表生成一个指定长度的随机字符串
<? function randomString($len) { srand(date("s")); $possible="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890!@#$%^&*()"; $str=""; while(strlen($str)<$len) { $str.=substr($possible,(rand()%(strlen($possible))),1); } return($str); } ?>