赞
踩
-
- function randStr($len=2,$format='ALL') {
- switch($format) {
- case 'ALL':
- $chars='ABCDEFGHIJKLMNOPQRSTUVWXYZ'; break;
- case 'CHAR':
- $chars='ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-@#~'; break;
- case 'NUMBER':
- $chars='0123456789'; break;
- default :
- $chars='ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-@#~';
- break;
- }
- mt_srand((double)microtime()*1000000*getmypid());
- $password="";
- while(strlen($password)<$len)
- $password.=substr($chars,(mt_rand()%strlen($chars)),1);
- return $password;
- }
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。