设置项目编号

admin2年前Laravel511
$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...

忘记密码

publicfunction forget(){    $phone = request()->input('phone');    $c...

手机号替换

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

两个经纬度之间的距离

    public function haversineGreatCircleDistance($latitude1, $longitude1, $latitude2, $lon...

百度浏览器中视频悬浮

  <video class="html5-video"                poster=...

base64 处理图片

public function images(){    $image = request()->input('image');    i...