一个php产生和生成随机数的函数代码
用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(6);
?>
用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(6);
?>