zoukankan      html  css  js  c++  java
  • 生成随机验证码

    /**
    * 生成随机验证码 
    * @param string $len 验证码长度
    *    @return string
    **/
    function GetRandStr($len) 
    { 
      $chars = array(
    
        "0", "1", "2", "3", "4", "5", "6", "7", "8", "9" , "A" , "B" , "C" , "D" , "E" , "F" , "G" , "H" , "I" , "J" , "K" , "L" , "M" , "N" , "O" , "P" , "Q" , "R" , "S" , "T" , "U" , "V" ,"W" , "X" , "Y" , "Z"
    
      ); 
      $charsLen = count($chars) - 1; 
      shuffle($chars); 
      $output = ""; 
      for ($i=0; $i<$len; $i++) 
      { 
        $output .= $chars[mt_rand(0, $charsLen)]; 
      } 
      return $output; 
    }
  • 相关阅读:
    [leetCode]剑指 Offer 43. 1~n整数中1出现的次数
    [leetCode]剑指 Offer 42. 连续子数组的最大和
    HDU
    HDU
    HDU
    HDU
    HDU
    HDU
    POJ
    POJ
  • 原文地址:https://www.cnblogs.com/yhdsir/p/4648571.html
Copyright © 2011-2022 走看看