function genrandomstring($len)
{
$chars = array(
a, b, c, d, e, f, g, h, i, j, k,
l, m, n, o, p, q, r, s, t, u, v,
w, x, y, z, a, b, c, d, e, f, g,
h, i, j, k, l, m, n, o, p, q, r,
s, t, u, v, w, x, y, z, 0, 1, 2,
3, 4, 5, 6, 7, 8, 9
);
$charslen = count($chars) - 1;
shuffle($chars);
$output = ;
for ($i=0; $i {
$output .= $chars[mt_rand(0, $charslen)];
}
return $output;
}
还有一种是php 自带的mt_rand 与rand 哦,不过建意最好用mt_rand这个事速度上优与rand
