当前位置:网站首页>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]所创,转载请带上原文链接,感谢
边栏推荐
猜你喜欢
这几个C++的坑,一旦踩中了,加班是肯定避免不了了!
Is there no way out for older programmers?
Arduino IDE搭建ESP8266开发环境,文件下载过慢解决方法 | ESP-01制作WiFi开关教程,改造宿舍灯
构建者模式(Builder pattern)
Learn to record and analyze
How to make a correct summary for 7 years?
Summary of template engine
Tencent: Although Ali's Taichung is good, it is not omnipotent!
Station B STM32 video learning
阿里云视频云技术专家 LVS 演讲全文:《“云端一体”的智能媒体生产制作演进之路》
随机推荐
Your random IO hard disk
CSP考试须知与各种小技巧
Restfulapi learning notes -- father son resources (4)
C++的那些事儿:从电饭煲到火箭,C++无处不在
Arduino ide build esp8266 development environment, slow file download solution | esp-01 make WiFi switch tutorial, transform dormitory lights
Is there no way out for older programmers?
框架-SPI四种模式+通用设备驱动实现-源码
Tencent: Although Ali's Taichung is good, it is not omnipotent!
vim-配置教程+源码
Application of four ergodic square of binary tree
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
阿里云的MaxCompute数加(原ODPS)用的怎样?
前后端分离跨域问题解决方案
关于update操作并发问题
Alibaba cloud accelerates its growth and further consolidates its leading edge
京东落地DevOps平台时爆发的冲突如何解决?
Awk implements SQL like join operation
API生命周期的5个阶段
On DSA of OpenGL
聊聊Go代码覆盖率技术与最佳实践