生成随机字符串,包含大写、小写字母、数字php代码
function randstr($length) {
$hash = '';
$chars = 'abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz';
$max = strlen($chars) - 1;
mt_srand((double)microtime() * 1000000);
for($i = 0; $i < $length; $i++) {
$hash .= $chars[mt_rand(0, $max)];
}
return $hash;
} 教程网址:https://www.phprm.com/code/36367.html
欢迎收藏∩_∩但请保留本文链接。