JoeHandsome 2019-08-27 20:55:31 110次浏览 1条评论 0 0 0
//获取本月起始时间戳和结束时间戳
public static function month_start_end(){
    $beginThismonth=mktime(0,0,0,date('m'),1,date('Y'));
    $endThismonth=mktime(23,59,59,date('m'),date('t'),date('Y'));
    $date_data['start'] = $beginThismonth;
    $date_data['end'] = $endThismonth;
    return $date_data;
}

//生成随机字符串,位数九位
public function CkServiceId($lastnum){
    $date_data = ArrayHelper::month_start_end();
    $time = time();
    if ($time <= $date_data['end'] && $time >= $date_data['start']){
        $ckserviceid = date('ymd') . sprintf('%03d',$lastnum+1);
    }else{
        $ckserviceid = date('ymd') . sprintf('%03d',1);
    }
    return $ckserviceid;
}
亿速云
您需要登录后才可以评论。登录 | 立即注册