设置项目编号

admin8个月前Laravel175
$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;
}

相关文章

修改密码

/** * 修改密码 */publicfunction setpass(){    $type = request()->input('type');// 1...

微信支付V3

 public static function pay($order_sn = '11111', $money = '12', $uid = 7) ...

查找下级所有数据

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

接口返回处理

public function __construct()    {        $action = request()->rout...

阿里云发送短信

public function sms(){    $moile = request()->input('mobile');    if...

手机号替换

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