<table cellspacing="0" cellpadding="0"><tr><td class="t_f" id="postmessage_48336"> <div class="blockcode"> <div id="code_va4"><ol> <li> <li><?php<li>/*<li> * php自动生成新密码自定义函数(带实例演示)<li> 适用环境: PHP5.2.x / mysql 5.0.x<li> 代码作者: xujiajay<li> 联系方式: xujiaphp@gmail.com<li>* */<li>function genPassword($min = 5, $max = 8) <li>{ <li> $validchars="abcdefghijklmnopqrstuvwxyz123456789"; <li> $max_char=strlen($validchars)-1; <li> $length=mt_rand($min,$max); <li> $password = ""; <li> for($i=0;$i<$length;$i ) <li> { <li> $password.=$validchars[mt_rand(0,$max_char)]; <li> } <li> return $password; <li> } <li> echo "新密码:".genPassword()."<br>"; </li> <li> echo "新密码:".genPassword(5,10)."<br>";</li> <li>?></li> </ol></div> <em onclick="copycode($('code_va4'));">复制代码</em> </div> </td></tr></table> <div id="comment_48336" class="cm"> </div> <div id="post_rate_div_48336"></div> <br><br>