天天躁日日躁狠狠躁AV麻豆-天天躁人人躁人人躁狂躁-天天澡夜夜澡人人澡-天天影视香色欲综合网-国产成人女人在线视频观看-国产成人女人视频在线观看

PHP生成隨機(jī)密碼類分享

類代碼:

<?php/** * php - Password Generator Class * Version 1.0.0 * */ if (@!is_object($passGen) || !isset($passGen)) {  $passGen = new Password;} class Password{   /**   * 大寫字母 A-Z   *   * @var array   */  protected $uppercase_chars;   /**   * 小寫字母 a-z   *   * @var array   */  protected $lowercase_chars;   /**   * 阿拉伯?dāng)?shù)字 0-9   *   * @var array   */  protected $number_chars;   /**   * 特殊字符   *   * @var array   */  protected $special_chars;   /**   * 其他特殊字符   *   * @var array   */  protected $extra_chars;   /**   * 最終用來(lái)生成密碼的所有字符   *   * @var array   */  protected $chars = array();   /**   * 密碼長(zhǎng)度   *   * @var array   */  public $length;   /**   * 是否使用大寫字母   *   * @var boolean   */  public $uppercase;   /**   * 是否使用小寫字母   *   * @var boolean   */  public $lowercase;   /**   * 是否使用阿拉伯?dāng)?shù)字   *   * @var boolean   */  public $number;   /**   * 是否使用特殊字符   *   * @var boolean   */  public $special;   /**   * 是否使用額外的特殊字符   *   * @var boolean   */  public $extra;   /**   * 初始化密碼設(shè)置   *   * @param int $length   */  function Password($length = 12)  {    $this->length = $length;         $this->configure(true, true, true, false, false);  }   /**   * 配置   */  function configure($uppercase = false, $lowercase = false, $number = false,            $special = false, $extra = false  ) {    $this->chars = array();     $this->upper_chars  = array(                 "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"                );    $this->lower_chars  = array(                 "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"                );    $this->number_chars = array(                 "1", "2", "3", "4", "5", "6", "7", "8", "9", "0"                );    $this->special_chars = array(                 "!", "@", "#", "$", "%", "^", "&", "*", "(", ")"                );    $this->extra_chars  = array(                 "[", "]", "{", "}", "-", "_", "+", "=", "<",                 ">", "?", "/", "`", "~", "|", ",", ".", ";", ":"                );     if (($this->uppercase = $uppercase) === true) {      $this->chars = array_merge($this->chars, $this->upper_chars);    }    if (($this->lowercase = $lowercase) === true) {      $this->chars = array_merge($this->chars, $this->lower_chars);    }    if (($this->number = $number) === true) {      $this->chars = array_merge($this->chars, $this->number_chars);    }    if (($this->special = $special) === true) {      $this->chars = array_merge($this->chars, $this->special_chars);    }    if (($this->extra = $extra) === true) {      $this->chars = array_merge($this->chars, $this->extra_chars);    }     $this->chars = array_unique($this->chars);  }     /**   * 從字符列中生成隨機(jī)密碼   *   * @return string   **/  function generate()  {    if (empty($this->chars)) {      return false;    }     $hash    = '';    $totalChars = count($this->chars) - 1;         for ($i = 0; $i < $this->length; $i++) {      $hash .= $this->chars[$this->random(0, $totalChars)];    }     return $hash;  }   /**   * 生成隨機(jī)數(shù)字   *   * @return int   */  function random($min = 0, $max = 0)  {    $max_random = 4294967295;     $random = uniqid(microtime() . mt_rand(), true);    $random = sha1(md5($random));     $value = substr($random, 0, 8);    $value = abs(hexdec($value));     if ($max != 0) {      $value = $min + ($max - $min + 1) * $value / ($max_random + 1);    }     return abs(intval($value));  }}

調(diào)用:

<?php include_once 'password.class.php'; echo $passGen->generate(); //FS4yq74e2LeE

php技術(shù)PHP生成隨機(jī)密碼類分享,轉(zhuǎn)載需保留來(lái)源!

鄭重聲明:本文版權(quán)歸原作者所有,轉(zhuǎn)載文章僅為傳播更多信息之目的,如作者信息標(biāo)記有誤,請(qǐng)第一時(shí)間聯(lián)系我們修改或刪除,多謝。

主站蜘蛛池模板: 一个人的免费完整在线观看HD | 亚洲青青青网伊人精品 | ai换脸女明星被躁在线观看免费 | 青青视频 在线 在线播放 | 亚洲日本欧美国产在线视 | 大桥未久与黑人中出视频 | 国内久久久久影院精品 | 毛片免费在线播放 | 国产在线高清亚洲精品一区 | 久久精品动漫网一区二区 | 波野结衣qvod | 日日噜噜大屁股熟妇 | 真人裸交有声性动态图 | 国产麻豆剧看黄在线观看 | 亚洲欧美日韩高清中文在线 | 国产免费69成人精品视频 | 有码 亚洲 制服 国产 在线 | 憋尿调教绝望之岛 | 动漫H片在线播放免费高清 动漫AV纯肉无码AV电影网 | 手机看片成人 | 漂亮美女2018完整版 | 亚洲一区免费香蕉在线 | 一品道门在线视频高清完整版 | 黄图gif揉胸吸奶 | a级成人免费毛片完整版 | 日本少妇内射视频播放舔 | 野花香HD免费高清版6高清版 | 久久国产亚洲精品AV麻豆 | 美女撒尿无遮挡免费中国 | 日韩精品一卡二卡三卡四卡2021 | 深爱激情站 | 亚洲午夜福利未满十八勿进 | 欧美怡红院视频一区二区三区 | 嘿嘿视频在线观看 成人 | 国产日韩成人内射视频 | 欧美动物交ideos | 成年免费三级视频 | 国产成人综合95精品视频免费 | 国产视频精品免费 | 亚洲免费人成在线视频观看 | 美女张开腿让男生桶动态图 |