function mt_rand_str ($l, $c = 'abcdefghijklmnopqrstuvwxyz1234567890') {
for ($s = '', $cl = strlen($c)-1, $i = 0; $i < $l; $s .= $c[mt_rand(0, $cl)], ++$i);
return $s;
}
echo mt_rand_str(8); // Something like mp2tmpsw
echo "<br>";
echo mt_rand_str(6, '0123456789ABCDEF'); // Something like B9CD0F
全站熱搜
留言列表