设置项目编号

admin11个月前Laravel233
$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 static function pay($order_sn = '11111', $money = '12', $uid = 7) ...

获取微信的Token

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

发送公众号信息

* 发送消息 */public function tosend($openid, $title, $content, $time, $aid){    $tokens = $thi...

微信支付V2

   public static function unifiedorder($openid, $out_trade_no, $total_fee, $notify)...

两个经纬度之间的距离

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

用户注册账号

public function register(){    $mobile = request()->input('mobile');   &nb...