当前位置:网站首页>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]所创,转载请带上原文链接,感谢
边栏推荐
- Application of four ergodic square of binary tree
- 技术总监7年总结,如何进行正确的沟通?
- How does Alibaba cloud's maxcompute add (original ODPs) work?
- Comics: looking for the best time to buy and sell stocks
- CSP考试须知与各种小技巧
- 构建者模式(Builder pattern)
- Golang ICMP Protocol detects viable hosts
- 聊聊Go代码覆盖率技术与最佳实践
- AI weekly: employees are allowed to voluntarily reduce salary; company response: employees are happy and satisfied; tiger tooth HR takes employees out of the company; Sweden forbids Huawei ZTE 5g equi
- Tips and skills of CSP examination
猜你喜欢
二叉树的四种遍历方应用
总结: 10月海外DeFi新项目,更多资管策略来了!
The birth of a new integrated memory and computing chip is conducive to the application of artificial intelligence~
Millet and oppo continue to soar in the European market, and Xiaomi is even closer to apple
[open source]. Net uses ORM to access Huawei gaussdb database
wanxin finance
搭载固态硬盘的服务器究竟比机械硬盘快多少
C + + things: from rice cookers to rockets, C + + is everywhere
Improvement of maintenance mode of laravel8 update
How to make a correct summary for 7 years?
随机推荐
10 common software architecture patterns
We made a medical version of the MNIST dataset, and found that the common automl algorithm is not so easy to use
3、 The parameters of the function
How does the system response time and throughput change with the increase of concurrency pressure during performance pressure testing
Interpretation of deepmind's latest paper: the causal reasoning algorithm in discrete probability tree is proposed for the first time
B站stm32视频学习
Arduino ide build esp8266 development environment, slow file download solution | esp-01 make WiFi switch tutorial, transform dormitory lights
大龄程序员没有出路吗?
rabbitmq(一)-基础入门
构建者模式(Builder pattern)
Restfulapi learning notes -- father son resources (4)
区块链周报:数字货币发展写入十四五规划;拜登邀请MIT数字货币计划高级顾问加入总统过渡团队;委内瑞拉推出国营加密交易所
2020-11-05
What is forsage Ethereum smart contract? What is the global decline of Ethereum
LeanCloud 十月变化
金融领域首个开源中文BERT预训练模型,熵简科技推出FinBERT 1.0
RestfulApi 学习笔记——父子资源(四)
It's just right. It's the ideal state
Comics: looking for the best time to buy and sell stocks
C++的那些事儿:从电饭煲到火箭,C++无处不在