/**
* 生成随机密码
*/
static function createNewpwd( $length = 8 ){
//密码字符集
$chars = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789';
$password = '';
for ( $i = 0; $i < $length; $i++ ){
// $password .= substr($chars, mt_rand(0, strlen($chars) – 1), 1);
$password .= $chars[ mt_rand(0,strlen($chars) - 1) ];
}
return $password;
* 生成随机密码
*/
static function createNewpwd( $length = 8 ){
//密码字符集
$chars = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789';
$password = '';
for ( $i = 0; $i < $length; $i++ ){
// $password .= substr($chars, mt_rand(0, strlen($chars) – 1), 1);
$password .= $chars[ mt_rand(0,strlen($chars) - 1) ];
}
return $password;
}
echo createNewpwd();