php 获取随机字符串算法
function get_rand_str($randLength=6,$addtime=1,$includenumber=0){ if ($includenumber){ $chars='abcdefghijklmnopqrstuvwxyzABCDEFGHJKLMNPQEST123456789'; }else { $chars='abcdefghijklmnopqrstuvwxyz'; } $len=strlen($chars); $randStr=''; for ($i=0;$i<$randLength;$i++){ $randStr.=$chars[rand(0,$len-1)]; } $tokenvalue=$randStr; if ($addtime){ $tokenvalue=$randStr.time(); } return $tokenvalue; }