【发布时间】:2017-12-27 09:55:09
【问题描述】:
嗨,我想生成 unique 五位数字 customer number 仅包含来自 0....9 的数字
我正在使用这个包:https://github.com/ivanakimov/hashids.php
我能够生成id,但它包含alphabet,就像...z
这就是我的生成方式
$id = 12;
$hashids = new Hashids\HashIds('eabangalore');
return $id = $hashids->encode(1, $id, 99); // output QBsLFJw
但我想输出类似 22345,46643,...等的东西
我该怎么做??
【问题讨论】:
-
为什么不使用 10000 到 99999 之间的随机数?
-
该 github 链接告诉您如何使用自定义“字母”...也就是 hashid 将使用的唯一字符