当前位置:网站首页>php中生成随机的6位邀请码
php中生成随机的6位邀请码
2022-07-02 06:23:00 【夜空の雪風】
前言
在系统开发的过程中有时候需要在用户注册的时候输入邀请码,这里分享一种快速生成邀请码的方法。
/** * 生成邀请码 * @param unitCode */
function create_invite_code($unitCode, $len = 3)
{
$arr = ["1", "2", "3", "5", "6", "7", "8", "9", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z"];
$arrLen = count($arr) - 1;
for ($i = 0; $i < $len; $i++) {
$unitCode .= $arr[mt_rand(0, $arrLen)];
}
return $unitCode;
}
例如:ANC39K
边栏推荐
- flex九宫格布局
- SQL injection closure judgment
- Win10桌面图标没有办法拖动(可以选中可以打开可以删除新建等操作但是不能拖动)
- Linux MySQL 5.6.51 Community Generic 安装教程
- Latex warning: citation "*****" on page y undefined on input line*
- Thread hierarchy in CUDA
- sprintf_ How to use s
- Flask migrate cannot detect db String() equal length change
- PXC high availability cluster summary
- CTF three count
猜你喜欢
Wechat applet Foundation
Solve the problem of bindchange event jitter of swiper component of wechat applet
Latex compiles Chinese in vscode and solves the problem of using Chinese path
UEditor .Net版本任意文件上传漏洞复现
[literature reading and thought notes 13] unprocessing images for learned raw denoising
Brief analysis of PHP session principle
如何调试微信内置浏览器应用(企业号、公众号、订阅号)
Latest CUDA environment configuration (win10 + CUDA 11.6 + vs2019)
sqli-labs通关汇总-page3
SQLI-LABS通关(less2-less5)
随机推荐
蚂蚁集团g6初探
Latest CUDA environment configuration (win10 + CUDA 11.6 + vs2019)
ModuleNotFoundError: No module named ‘jieba. analyse‘; ‘ jieba‘ is not a package
Linux MySQL 5.6.51 Community Generic 安装教程
Win10: add or delete boot items, and add user-defined boot files to boot items
Uploading attachments using Win32 in Web Automation
Fe - use of weex development weex UI components and configuration use
After reading useful blogs
[daily question 1] write a function to judge whether a string is the string after the rotation of another string.
Sqli labs customs clearance summary-page3
JS judge whether the object is empty
PXC high availability cluster summary
js判断对象是否为空
Kotlin - verify whether the time format is yyyy MM DD hh:mm:ss
Review of reflection topics
Sentry搭建和使用
The default Google browser cannot open the link (clicking the hyperlink does not respond)
2021-07-05C#/CAD二次开发创建圆弧(4)
由於不正常斷電導致的unexpected inconsistency;RUN fsck MANUALLY問題已解决
Anti shake and throttling of JS