当前位置:网站首页>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
边栏推荐
- Common prototype methods of JS array
- SQL injection closure judgment
- [self cultivation of programmers] - Reflection on job hunting Part II
- Utilisation de la carte et de foreach dans JS
- 如何调试微信内置浏览器应用(企业号、公众号、订阅号)
- JS delete the last character of the string
- The table component specifies the concatenation parallel method
- Sqli labs customs clearance summary-page3
- AWD learning
- js删除字符串的最后一位
猜你喜欢

Usage of map and foreach in JS

Win10网络图标消失,网络图标变成灰色,打开网络设置闪退等问题解决

蚂蚁集团g6初探

How to debug wechat built-in browser applications (enterprise number, official account, subscription number)

Apt command reports certificate error certificate verification failed: the certificate is not trusted

sqli-labs通关汇总-page4

Thread hierarchy in CUDA

Solve the problem of bindchange event jitter of swiper component of wechat applet

Latex warning: citation "*****" on page y undefined on input line*

Win10:添加或者删除开机启动项,在开机启动项中添加在用户自定义的启动文件
随机推荐
Pytest (1) case collection rules
In depth study of JVM bottom layer (V): class loading mechanism
SQLI-LABS通关(less15-less17)
Utilisation de la carte et de foreach dans JS
SQL注入闭合判断
sqli-labs通关汇总-page1
[literature reading and thought notes 13] unprocessing images for learned raw denoising
2020-9-23 use of QT timer qtimer class.
Brief analysis of PHP session principle
Latex compiles Chinese in vscode and solves the problem of using Chinese path
DeprecationWarning: . ix is deprecated. Please use. loc for label based indexing or. iloc for positi
Latex 报错 LaTeX Error: The font size command \normalsize is not defined问题解决
PHP Session原理简析
Common function writing method and set get writing method for calculating attributes
Win电脑截图黑屏解决办法
Huawei mindspire open source internship machine test questions
Overload global and member new/delete
JS countdown case
SQLI-LABS通关(less1)
js删除字符串的最后一位