', '~', '+', '=', ',', '.' )); } $charsLen = count($chars) - 1; shuffle($chars); $password = ''; for($i=0; $i<$length; $i++){ $password .= $chars[mt_rand(0, $charsLen)]; } return $password; } public static function generateOrderNo($type) { $now = time(); $key = RedisKey::getOrderNoKey($type, $now); $incrId = Redis::incr($key); $incrId = '' . $incrId; Redis::expire($key, 5*60); $padLength = 6 - strlen($incrId); $incrId = str_pad($incrId, $padLength, '0', STR_PAD_LEFT); return date('YmdHis', $now) . $incrId; } }