当前位置:网站首页>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
边栏推荐
- 20210306 reprint how to make TextEdit have background pictures
- Atcoder beginer contest 253 F - operations on a matrix / / tree array
- CAD二次开发 对象
- Loops in tensorrt
- Record RDS troubleshooting once -- RDS capacity increases dramatically
- 2021-07-19C#CAD二次开发创建多线段
- PgSQL learning notes
- Review of reflection topics
- ModuleNotFoundError: No module named ‘jieba. analyse‘; ‘ jieba‘ is not a package
- Cve-2015-1635 (ms15-034) Remote Code Execution Vulnerability recurrence
猜你喜欢

The table component specifies the concatenation parallel method

Date time API details

Latex在VSCODE中编译中文,使用中文路径问题解决

sqli-labs通关汇总-page1

Linux MySQL 5.6.51 community generic installation tutorial

Cve-2015-1635 (ms15-034) Remote Code Execution Vulnerability recurrence

Win10: add or delete boot items, and add user-defined boot files to boot items

Solution to the black screen of win computer screenshot

Review of reflection topics

如何调试微信内置浏览器应用(企业号、公众号、订阅号)
随机推荐
Latex compiles Chinese in vscode and solves the problem of using Chinese path
Nodejs - Express middleware modification header: typeerror [err_invalid_char]: invalid character in header content
Blog directory of zzq -- updated on 20210601
There is no way to drag the win10 desktop icon (you can select it, open it, delete it, create it, etc., but you can't drag it)
In depth study of JVM bottom layer (IV): class file structure
JS delete the last character of the string
Fe - use of weex development weex UI components and configuration use
SQL injection closure judgment
js创建一个自定义json数组
Error "list" object is not callable in Web automatic switching window
PXC high availability cluster summary
js把一个数组分割成每三个一组
Sqli-labs customs clearance (less18-less20)
Improve user experience defensive programming
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
There are multiple good constructors and room will problem
Linux MySQL 5.6.51 community generic installation tutorial
20201025 visual studio2019 qt5.14 use of signal and slot functions
Explanation and application of annotation and reflection