当前位置:网站首页>PHP generates unique strings
PHP generates unique strings
2020-11-08 16:17:00 【Back as a teenager】
php Unique string generation mode uniqid ......
- High concurrency 32 Bit unique string ;
- Variable unique string ;
- The order number is unique ;
- Low frequency 13 Bit only string ;
Generate initial password
$salt = substr(uniqid(rand()),-6);
$key = 'xx.xxx.com';
$pwd = md5(md5('123456').$salt.$key);
Generating uniqueness id Several ways to
uniqid(); 13 A string
uniqid('',true); 23 A string
md5(uniqid(mt_rand(1,10000)));32 A string
md5(uniqid(md5(microtime(true)),true)); 32 A string
md5( uniqid( md5(microtime(true)),true ) . mt_rand(1,10000) );32 A string
session_create_id()
// establish 24 Bit unique value 14+6+4 20140507115523 123456 1234
date('YmdHis').substr(microtime(),2,6).mt_rand(1000,9999);
-
- uniqid() 13 A string
$units = array();
for ($i = 0; $i < 3; $i++) {
$units[] = uniqid();
}
var_export($units);
array (
0 => '5fa799bee9f7e',
1 => '5fa799bee9f95',
2 => '5fa799bee9f96',
)
-
- uniqid() 23 A string
$units = array();
for ($i = 0; $i < 3; $i++) {
$units[] = uniqid('', true);
}
var_export($units);
array (
0 => '5fa79a8371e2b9.16693379',
1 => '5fa79a8371e573.86696425',
2 => '5fa79a8371e5a8.44085231',
)
-
- uniqid() 32 A string
$units = array();
for ($i = 0; $i < 3; $i++) {
$units[] = md5(uniqid(mt_rand(), true));
// $units[] = md5(uniqid(md5(microtime(true)),true))
}
var_export($units);
array (
0 => '56d06914ee44c0f568be745edf1410de',
1 => '914a38fe5a2b3124bc42593b39c12a22',
2 => 'fa4853979a3e6d19748c9b354f034d49',
)
Reference link
版权声明
本文为[Back as a teenager]所创,转载请带上原文链接,感谢
边栏推荐
- Framework - SPI four modes + general device driver implementation - source code
- 喜获蚂蚁offer,定级p7,面经分享,万字长文带你走完面试全过程
- TypeScript(1-2-2)
- Jsliang job series - 07 - promise
- 聊聊Go代码覆盖率技术与最佳实践
- LiteOS-消息队列-实战
- 阿里云加速增长,进一步巩固领先优势
- Learn to record and analyze
- Google's AI model, which can translate 101 languages, is only one more than Facebook
- Five phases of API life cycle
猜你喜欢
Apache Kylin远程代码执行漏洞复现(CVE-2020-1956)
python开发qt程序读取图片的简单流程
Improvement of rate limit for laravel8 update
Drink soda, a bottle of soda water 1 yuan, two empty bottles can change a bottle of soda, give 20 yuan, how much soda can you
.NET 大数据量并发解决方案
谷歌开源能翻译101种语言的AI模型,只比Facebook多一种
Xiaoqingtai officially set foot on the third day of no return
小米、OPPO在欧洲市场继续飙涨,小米更是直逼苹果
VIM configuration tutorial + source code
函数分类大pk!sigmoid和softmax,到底分别怎么用?
随机推荐
DeepMind 最新论文解读:首次提出离散概率树中的因果推理算法
Recurrence of Apache kylin Remote Code Execution Vulnerability (cve-2020-1956)
Leancloud changes in October
The network adapter could not establish the connection
Don't release resources in finally, unlock a new pose!
Learn to record and analyze
Builder pattern
SQL 速查
RestfulApi 学习笔记——父子资源(四)
数据库连接报错之IO异常(The Network Adapter could not establish the connection)
Mac环境安装Composer
write文件一个字节后何时发起写磁盘IO
I used Python to find out all the people who deleted my wechat and deleted them automatically
Framework - SPI four modes + general device driver implementation - source code
Liteos message queuing actual combat
Dev-c++在windows环境下无法debug(调试)的解决方案
Improvement of maintenance mode of laravel8 update
京东落地DevOps平台时爆发的冲突如何解决?
Alibaba cloud accelerates its growth and further consolidates its leading edge
SQL quick query