龙盟编程博客 | 无障碍搜索 | 云盘搜索神器
快速搜索
主页 > web编程 > php编程 >

php 自动生成密码

时间:2014-06-14 15:09来源:网络整理 作者:网络 点击:
分享到:
自动生成密码 [代码片段(20行)]
function generatePassword($length=9, $strength=0) {
    $vowels = 'aeuy';
    $consonants = 'bdghjmnpqrstvz';
    if ($strength >= 1) {
        $consonants .= 'BDGHJLMNPQRSTVWXZ';
    }
    if ($strength >= 2) {
        $vowels .= "AEUY";
    }
    if ($strength >= 4) {
        $consonants .= '23456789';
    }
    if ($strength >= 8 ) {
        $vowels .= '@#$%';
    }

    $password = '';
    $alt = time() % 2;
    for ($i = 0; $i                 
精彩图集

赞助商链接