php windows 密钥生成,PHP:生成唯一用户密钥的选项

I have one last thing that I want to

get it right which is the user key. I

want to store an unique key for each

member/ user who registers at my

website. So this key must be unique

and not duplicate. I am thinking to

use the user email and hash it with

timedate or something

>我会让你的数据库使用autoincrement为你处理这个问题

>您也可以使用uniqid:md5(uniqid(rand(),TRUE));

index.php文件:

for ($i=0;$i<10;$i++) {

echo md5(uniqid(rand(), TRUE)) . "\n";

}

输出:

php index.php

ba0d9aad1ff0ceadf4b25f101099b91e

b5a6db5e174b426061d3d3835a6fcaea

54be6d3a03e0590917ed20b097442e3a

6e208a61eae8cfd102d4a41decf0f64e

2cafac5402815af87e8299e5e67016bd

95e839097a566471c70fe357e5a101d2

c6908532bda6f926debdda754b02f931

aac7adf999dd4dd009f208b176ea90d0

1ed7779229e57b05adc088b375582cfb

e016a684564d5cdb89201ebab1038609

它们都是独一无二的,你可以使用它们.你不应该做任何其他事情?

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值