生成特定长度随机字符串方法
2017-1-6 dingshangchao php开发
function randchar($length = 16){
$chars= "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
$str = "";
for ($i = 0; $i < $length; $i ++) {
$str .= substr($chars, mt_rand(0, strlen($chars) - 1), 1);
}
return $str;
}
« js拖拽排序
|
输出10000以内质数»