如何生成1~9,a~z,A~Z之间XXX位随机数
/**
* 生成随机数
* @param int $length ?度
* @return string
*/
function randomkey($length) {
$hash = '';
$chars = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890';
$max = strlen($chars) - 1;
for ($i = 0; $i $hash .= $chars[mt_rand(0, $max)];
}
return $hash;
}