gongzhonghao.png
扫码关注我们
最新赞助活动温馨提示:自愿赞助服务器费用,学生和没有工作的整站资源免费下载!
头像

PHP生出随机字符串函数

来源:http://erdangjiade.com/topic/1985.html 你好,世界。 2017-09-25 22:42浏览(15)

<?php  

/**   
* 产生随机字符串   
*   
* 产生一个指定长度的随机字符串,并返回给用户   
*   
* @access public   
* @param int $len 产生字符串的位数   
* @return string   
*/   
function randStr($len=6) {   
$chars='ABDEFGHJKLMNPQRSTVWXYabdefghijkmnpqrstvwxy23456789#%*'; // characters to build the password from   
mt_srand((double)microtime()*1000000*getmypid()); // seed the random number generater (must be done)   
$password='';   
while(strlen($password)<$len)   
$password.=substr($chars,(mt_rand()%strlen($chars)),1);   
return $password;   
}  

?>

以上就是PHP生出随机字符串函数的详细内容,更多请关注二当家的素材网其它相关文章!

评论0
头像

友情提示:垃圾评论一律封号 加我微信:826096331拉你进VIP群学习群

1 2