|
1
2
3
4
5
6
7
8 |
/* 生成一个串,uniqid(rand());uniqid(prefix,more_entropy)函数基于以微秒计的当前时间,生成一个唯一的 ID。如果 prefix 参数为空,则返回的字符串有 13 个字符串长。如果 more_entropy 参数设置为 true,则是 23 个字符串长。*/取出后6位$salt = substr(uniqid(rand()),-6);$password
= md5(md5($password).$salt); 这样生成一个密码 salt会被保存在数据库中 登录的时候会用到验证 |
类似discuz密码的生成规则,布布扣,bubuko.com
原文:http://www.cnblogs.com/xy404/p/3656920.html