设置项目编号

admin1年前Laravel375
$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;
}

相关文章

下载文件

public function img_url() { $id = request()->param('id', 1122); $info = Db::name('...

腾讯云发送短信

<?phpnamespace App\Http\Controllers;use Illuminate\Http\Request;use Illuminate\Support\Facades\DB...

微信开放平台-扫码登录

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

百度浏览器中视频悬浮

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

获取微信的Token

 public function Token()    {        $this->path = __DIR__ . &...

两个经纬度之间的距离

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