<?php
// for($i=873;$i<1100;$i++){
// echo "<br>";
// echo $i."____".mt_rand(1,10);
// }
$ke = range(400, 699);
$va=r();
$he=array_combine($ke, $va);
// var_dump(r());
foreach ($he as $k => $v) {
echo "<br>";
echo $k.'____'.$v;
}
function r(){
$b=array();
for($i=0;$i<30;$i++){
$a= range(1, 10);
shuffle($a);
$b=array_merge($b,$a);
}
return $b;
}
?>
——————————————————————————
<?php
function rand_word($length = 4,$type=1)
{
// $chars = '23456789ABCDEFGHJKLMNPQRSTUVWXYZ';
//纯字母
if($type==1){
$chars = '2345678910';
}else if($type==2){
$chars = 'ABCDEFGHJKLMNPQRSTUVWXYZ';
}else if($type==3){
$chars = '123456789abcdefghijklmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ';
}
for ($i = 0, $count = strlen($chars); $i < $count; $i++)
{
$arr[$i] = $chars[$i];
}
mt_srand((double) microtime() * 1000000);
shuffle($arr);
return substr(implode('', $arr), 5, $length);
}
echo rand_word(2,2);
date("YmdHis").substr(microtime() * 1000000, 1, 2).$pad;
————————————————————
function make_password($pw_length){
$low_ascii_bound=48;
$upper_ascii_bound=122;
$notuse=array(58,59,60,61,62,63,64,91,92,93,94,95,96);
$i=0;
$password1='';
while($i<$pw_length)
{
if(PHP_VERSION<'4.2.0')
{
mt_srand((double)microtime()*1000000);
}
$randnum=mt_rand($low_ascii_bound,$upper_ascii_bound);
if(!in_array($randnum,$notuse))
{
$password1=$password1.chr($randnum);
$i++;
}
}
return $password1;
}
echo make_password(6);
——————————
static function get_random_name()
{
$str = date('Ymd');
for ($i = 0; $i < 6; $i++)
{
$str .= chr(mt_rand(97, 122));
}
return $str;
}