Loading... 可做随机命名 随机卡密 第一种: 利用此函数生成随机文件名或强度较高的卡密等 <?php function randStr($len=6) { $chars='ABDEFGHJKLMNPQRSTVWXYabdefghijkmnpqrstvwxy23456789#%*'; mt_srand((double)microtime()*1000000*getmypid()); $password=''; while(strlen($password)<$len) $password.=substr($chars,(mt_rand()%strlen($chars)),1); return $password; } echo randStr(); ?> 第二种: <?php header("Content-type:text/html;charset=utf-8"); function randStr($length = 6){ $password = ''; //将你想要的字符添加到下面字符串中,默认是数字0-9和26个英文字母 $chars = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"; $char_len = strlen($chars); for($i=0;$i<$length;$i++){ $loop = mt_rand(0, ($char_len-1)); //将这个字符串当作一个数组,随机取出一个字符,并循环拼接成你需要的位数 $password .= $chars[$loop]; } return $password; } echo randStr(12); //随机生成一个12位数的密码 ?><hr class="content-Ideal" style="margin-top:50px" /><blockquote class="content-Ideal" style="font-style:normal"><p class="content-Ideal">版权属于:苏安吖</p><p class="content-Ideal">本文链接:<a class="content-Ideal" href="https://ipayy.net/web/21.html">https://ipayy.net/web/21.html</a></p><p class="content-Ideal">转载时须注明出处及本声明</p></blockquote> Last modification:February 3rd, 2020 at 11:41 am © 允许规范转载 Support 嘤嘤嘤,来打赏点吧ε٩(๑> ₃ <)۶ з ×Close Appreciate the author Sweeping payments Pay by AliPay Pay by WeChat