<?php
echo get_rand_password(4); //密碼長度可以使用數字控制
function get_rand_password($len = 8) //Password length can use digital control
{
// remove o,0,1,l
$word[] = 'abcdefghijkmnpqrstuvwxyz';
$word[] = 'ABCDEFGHIJKLMNPQRSTUVWXYZ';
$word[] = '!@#$%^&*+-=';
$word[] = '23456789';
$word_str = '';
foreach($word as $v)
$word_str .= $v;
$password ='';
$l = strlen($word_str);
for ($i = 0; $i < $len; $i++) {
$password .= $word_str[rand() % $l];
}
return $password;
}
?>