function rand_str($randLength = 16) { //$randLength = 随机字符串的长度
$chars = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUNWXYZ'; //自定义随机出现的字符
$len = strlen($chars);
$randStr = '';
for ($i = 0; $i < $randLength; $i++) {
$randStr .= $chars[mt_rand(0, $len - 1)];
}
$tokenvalue = $randStr;
return $tokenvalue;
}
文章评论