只需一步,快速开始
<?php header("Content-type:text/html;charset=utf-8"); function getRandPass($length = 6){ $password = ''; //将你想要的字符添加到下面字符串中,默认是数字0-9和26个英文字母 $chars = "356789adefghnrtADEFGHNRT356789"; $char_len = strlen($chars); for($i=0;$i<$length;$i++){ $loop = mt_rand(0, ($char_len-1)); //将这个字符串当作一个数组,随机取出一个字符,并循环拼接成你需要的位数 $password .= $chars[$loop]; } return $password; } echo getRandPass(8); //随机生成一个8位数的密码 ?>
举报
本版积分规则 发表回复 回帖后跳转到最后一页
Archiver|手机版|小黑屋|全球主机交流论坛
GMT+8, 2026-1-13 16:38 , Processed in 0.073795 second(s), 14 queries , Gzip On, MemCache On.
Powered by Discuz! X3.4
© 2001-2023 Discuz! Team.