<html>
<head>
<title>随机产生密码!</title>
</head>
<body>
<?php
function randompassword($slength=6){
$sall=explode(" ",
"a b c d e f g h i j k l m n o p q r s t u v w x y z".
" A B C D E F G H I J K L M N O P Q R S T U V W X Y Z".
" 0 1 2 3 4 5 6 7 8 9");
for($si=0; $si<$slength;$si++)
mt_srand((double)microtime()*1000000);
$srandy=mt_rand(0,61);
$spass=$sall[$srandy];
return $spass;
}
echo randompassword(8);
?>
</body>
</html>
是不是这样子的?
<head>
<title>随机产生密码!</title>
</head>
<body>
<?php
function randompassword($slength=6){
$sall=explode(" ",
"a b c d e f g h i j k l m n o p q r s t u v w x y z".
" A B C D E F G H I J K L M N O P Q R S T U V W X Y Z".
" 0 1 2 3 4 5 6 7 8 9");
for($si=0; $si<$slength;$si++)
mt_srand((double)microtime()*1000000);
$srandy=mt_rand(0,61);
$spass=$sall[$srandy];
return $spass;
}
echo randompassword(8);
?>
</body>
</html>
是不是这样子的?
解决方案 »
- PHP如何随机读取多个文本
- 散分 ~ 圣诞快乐
- 跪求高人指点:在php中如何用什么函数可以获得远程用户IP及系统时间哈?
- PHP文章系统的内容中含有代码的显示问题!在线等!
- 搜索算法:我想做一个搜索程序,请大家帮帮我!
- 非常急的问题,高分求助。
- 请教:如何实现ASP中binaryread和binarywrite的功能?
- 大家快来帮忙看看,到底哪个背景好看一些?还是不要背景好看?????~~~~~~~
- PHP中cookie的问题!!
- 斑竹大人?你真的叫宇凡?
- 请问在mysql中有类似msserver中的那种自动增长的字段类型吗?
- apache2.0.48+PHP4.3.4. 我用ADO连接数据库,不出错. 可是也没连上
<head>
<title>随机产生密码!</title>
</head>
<body>
<?php
function randompassword($slength=6){
$sall=explode(" ",
"a b c d e f g h i j k l m n o p q r s t u v w x y z".
" A B C D E F G H I J K L M N O P Q R S T U V W X Y Z".
" 0 1 2 3 4 5 6 7 8 9");
for($si=0; $si<$slength;$si++)
mt_srand((double)microtime()*1000000);
$srandy=(string)mt_rand();
$spass="";
for($i="0";$i<$slength;$i++){
$spass.=$sall[$srandy[$i]];
}
return $spass;
}
echo randompassword(8);
?>
</body>
</html>