/**@name 获取随机字符串,大小写字母+数字,转变不区分大小写 *@param $len 长度 *@param $ignoreCase 忽略大小写 * */ function get_salt($len=6, $ignoreCase=true) { //return substr(uniqid(rand()), -$len); $discode="123546789wertyupkjhgfdaszxcvbnm".($ignoreCase?'': 'QABCDEFGHJKLMNPRSTUVWXYZ'); $code_len = strlen($discode); $code = ""; for($j=0; $j<$len; $j++){ $code .= $discode[rand(0, $code_len-1)]; } return $code; } echo get_salt(13, true);
云EC电商学习进阶:common.php