输出七位密码,前6位区分大小写,最后一个是可见符号

来源:互联网 发布:人工智能的相关文献 编辑:程序博客网 时间:2024/05/30 23:39
function readable_random_string($length = 6){     $conso=array("b","c","d","f","g","h","j","k","l",     "m","n","p","r","s","t","v","w","x","y","z",    "B","C","D","F","G","H","J","K","L",     "M","N","P","R","S","T","V","W","X","Y","Z");     $vocal=array("a","e","i","o","u",        "A","E","I","O","U");     $password="";     srand ((double)microtime()*1000000);     $max = $length/2;     for($i=1; $i<=$max; $i++)     {     $password.=$conso[rand(0,37)];     $password.=$vocal[rand(0,9)];     }     $strong_char = array("!","@","#","$","%","^","&","*");    $password.=$strong_char[rand(0,7)];     return $password; } echo readable_random_string();

基于上个例子,修改而来的。输出示例:

juJedu#

原创粉丝点击