chonla / randomizr
字符串随机化器
0.1.1
2019-01-29 04:59 UTC
Requires
- php: ^7
Requires (Dev)
- phpunit/phpunit: ^7
This package is auto-updated.
Last update: 2024-09-20 17:16:09 UTC
README
字符串随机化器
API
$rand = new Randomizr;
使用 number() 获取只包含0到9的随机字符串
$result = $rand->number(10);
使用 alphabet() 获取只包含a到z(大小写字母)的随机字符串
$result = $rand->alphabet(10);
使用 alphanumeric() 获取只包含a到z(大小写字母)和0到9的随机字符串
$result = $rand->alphanumeric(10);
使用 hexadecimal() 获取只包含十六进制数字(0到f)的随机字符串
$result = $rand->hexadecimal(10);
使用 rand() 随机生成任意字符集和长度的字符串
$result = $rand->rand("abc", 10); // this will return a string containing either a or b or c with length of 10