randpwd.php
<?php
function create_password($pw_length = 8)
{
$randpwd = '';
for ($i = 0; $i < $pw_length; $i++)
{
$randpwd.=chr(mt_rand(33,126));
}
return $randpwd;
}
echo create_password();
?>
此方法可以生成任何位数的随机密码。
randpwd.php
<?php
function create_password($pw_length = 8)
{
$randpwd = '';
for ($i = 0; $i < $pw_length; $i++)
{
$randpwd.=chr(mt_rand(33,126));
}
return $randpwd;
}
echo create_password();
?>