当前位置:网站首页>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]所创,转载请带上原文链接,感谢
边栏推荐
- Workers, workers soul, draw lifelong members, become a person!
- Do these mistakes in your resume affect your annual salary of one million?
- 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
- Travel notes of Suzhou
- 2035我们将建成这样的国家
- AI周报:允许“员工自愿降薪”;公司回应:员工内心高兴满意;虎牙HR将员工抬出公司;瑞典禁用华为中兴5G设备
- 性能压测时,并发压力增加,系统响应时间和吞吐量如何变化
- 小米、OPPO在欧洲市场继续飙涨,小米更是直逼苹果
- TypeScript(1-2-2)
- 模板引擎的整理归纳
猜你喜欢

构建者模式(Builder pattern)

Gopherchina 2020 Conference

数据库连接报错之IO异常(The Network Adapter could not establish the connection)

How to make a correct summary for 7 years?

Comics: looking for the best time to buy and sell stocks

我用 Python 找出了删除我微信的所有人并将他们自动化删除了

One minute comprehensive understanding of forsage smart contract global shared Ethereum matrix plan

Huawei has an absolute advantage in the 5g mobile phone market, and the market share of Xiaomi is divided by the market survey organization

非常规聚合问题举例

漫画:寻找股票买入卖出的最佳时机(整合版)
随机推荐
Travel notes of Suzhou
wanxin finance
C + + things: from rice cookers to rockets, C + + is everywhere
Development of uni app imitating wechat app
Js中常见的内存泄漏场景
小青台正式踏上不归路的第3天
3、 The parameters of the function
write文件一个字节后何时发起写磁盘IO
SQL quick query
Use markdown
聊聊Go代码覆盖率技术与最佳实践
laravel8更新之速率限制改进
Liteos message queuing actual combat
进入互联网得知道的必备法律法规有哪些?
重返全球第三,小米做对了什么?
一分钟全面看懂forsage智能合约全球共享以太坊矩阵计划
How to cooperate with people in software development? |Daily anecdotes
构建者模式(Builder pattern)
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
Learn to record and analyze