邀请码生成
function createCode($user_id) { static $source_string = 'E5FCDG3HQA4B1NOPIJ2RSTUV67MWX89KLYZ'; $num = $user_id; $code = ''; while ( $num > 0) { $mod = $num % 35; $num = ($num - $mod) / 35; $code = $source_string[$mod].$code; } if(empty($code[3])) $code = str_pad($code,4,'0',STR_PAD_LEFT); return $code; }
//Enter your code here, enjoy! $chars = str_split('R5NT2R'); $user_id = 0; $source_string = 'E5FCDG3HQA4B1NOPIJ2RSTUV67MWX89KLYZ'; $char_dict = array_flip(str_split($source_string)); foreach($chars as $i => $v){ $user_id = $user_id * 35 + $char_dict[$v]; } echo($user_id);
版权声明:
作者:ForDream
链接:https://ishoud.com/index.php/2021/08/24/117.html
来源:工具人
文章版权归作者所有,未经允许请勿转载。
THE END
0
二维码
海报
邀请码生成
function createCode($user_id) {
static $source_string = 'E5FCDG3HQA4B1NOPIJ2RSTUV67MWX89KLYZ';
$num = $user_id;
$code = '';
whi……

共有 0 条评论