function randomkeys($length)
{
$pattern = '1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLOMNOPQRSTUVWXYZ'; //字符池
for($i=0;$i<$length;$i++)
{
$key .= $pattern{mt_rand(0,35)}; //生成php随机数
}
return $key;
}
echo randomkeys(8)."<br />";
function randomkeys2($length)
{
$output='';
for ($a = 0; $a < $length; $a++) {
$output .= chr(mt_rand(33, 126)); //生成php随机数
}
return $output;
}
echo randomkeys2(8)."<br />";