国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 編程 > PHP > 正文

PHP生成隨機密碼類分享

2020-03-22 18:00:28
字體:
來源:轉載
供稿:網友
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); * 從字符列中生成隨機密碼 * @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; * 生成隨機數字 * @return int function random($min = 0, $max = 0) $max_random = 4294967295; $random = uniqid(microtime() . mt_rand(), true); $random = sha1(md5($random)); $html' target='_blank'>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)); } 調用:
include_once 'password.class.php'; echo $passGen- generate(); //FS4yq74e2LeEPHP教程

鄭重聲明:本文版權歸原作者所有,轉載文章僅為傳播更多信息之目的,如作者信息標記有誤,請第一時間聯系我們修改或刪除,多謝。

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 轮台县| 海门市| 彭泽县| 鹤壁市| 南靖县| 德州市| 元朗区| 嘉鱼县| 清苑县| 阳谷县| 赤壁市| 衢州市| 即墨市| 宁海县| 房产| 迁安市| 辛集市| 恭城| 镇巴县| 瑞金市| 民乐县| 新乡市| 郁南县| 香港 | 邛崃市| 杭锦后旗| 镇巴县| 梁河县| 庆元县| 焦作市| 枞阳县| 岑巩县| 左权县| 曲松县| 阿拉善盟| 临沂市| 忻城县| 北辰区| 新巴尔虎左旗| 洪江市| 页游|