设置项目编号

admin2年前Laravel405
$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;
}

相关文章

按照距离远近排序

   $distance = "ACOS(SIN(( $lat * 3.1415) / 180 ) *SIN((lat * 3.1415) / 180 ) +COS((...

公众号登录

public function wxlogin(){       $code = request()->input('code'); &n...

生成唯一的订单号

public function get_order_sn() {     return date('Ymd') ...

验证手机号

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

生成二维码

public function qrcode($uid){    require_once base_path() . '/public/phpqrcode/phpqrco...

手机号替换

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