パスワード関数の生成
2564 ワード
<?php
/*
**
**
**
*/
function createPassword($psdLegth=6){
$password = "";
for($i=1;$i<=$psdLegth;$i++){
$password .= chr(mt_rand(33,126));
}
return $password;
}
echo createPassword();
function createPassword1( $length = 6 ) {
$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;
}