生成16位随机编码
1.使用hashids (注意需要扩展)
转载链接:
GitHub - vinkla/hashids: A small PHP library to generate YouTube-like ids from numbers. Use it when you don't want to expose your database ids to t1he user.
2.使用php自带函数uniid()+hash+microtime
$uniqueId = hash('fnv164', uniqid().microtime(true));
fnv164是hash的算法 这里推荐查看这位大佬的博客,根据不同的算法生成唯一字符串
php各类hash算法长度及性能 - ciaos - 博客园
最后
以上就是健壮战斗机最近收集整理的关于PHP+hash 生成唯一字符串的全部内容,更多相关PHP+hash内容请搜索靠谱客的其他文章。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复