设置项目编号

admin2年前Laravel494
$max = Db::table('member')->max('id') ?? 0; 
if ($max < 100000) {
    $cd = $this->createNonceStr(6 - strlen($max));
    $max = str_pad($max, 6, $cd, STR_PAD_LEFT);

}



public function createNonceStr($length = 16)
{
    $chars = '0123456789';
    $str = ''; for ($i = 0; $i < $length; $i++) {
        $str .= substr($chars, mt_rand(0, strlen($chars) - 1), 1);
    } return $str;
}

相关文章

微信退款v3

/** * 微信 退款 操作 */ public function refund($out_trade_no, $refund_money) { $time = time();...

抖音小程序登录

$code = request()->input('code');$nickname = request()->input('nickName');$ava...

查找下级所有数据

public function bottom($mid = 3){    $members = DB::select('select id,parent_id,`level...

验证手机号

public function phone($phone){    $pat = '/'        . '^13...

手机号替换

 $vv = substr_replace($vv, '****', 3, 4) ....

微信开放平台-扫码登录

public function wx_info(){    $code = request()->input('code');    if...