在PHP中创建密码
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了在PHP中创建密码相关的知识,希望对你有一定的参考价值。
function create_password($pw_length = 8, $use_caps = true, $use_numeric = true, $use_specials = true) { $num_specials = 0; $reg_length = $pw_length; for ($ch = 97; $ch <= 122; $ch++) $chars[] = $ch; // create a-z if ($use_caps) for ($ca = 65; $ca <= 90; $ca++) $caps[] = $ca; // create A-Z if ($use_numeric) for ($nu = 48; $nu <= 57; $nu++) $numbers[] = $nu; // create 0-9 if ($use_specials) { $num_specials = $pw_length - $reg_length; if ($num_specials > 5) $num_specials = 5; for ($si = 33; $si <= 47; $si++) $signs[] = $si; foreach ($rs_keys as $rs) { } } foreach ($rand_keys as $rand) { } }
以上是关于在PHP中创建密码的主要内容,如果未能解决你的问题,请参考以下文章