/* * 根据id生成员工编号 至少八位 前四位年份 eg:20180001 * */ public static function generateEmployeeByNum($num){ $number = date('Y'); $numLength = strlen($num); if($numLength == 0){ $number .= date('Hs'); }elseif($numLength > 0 && $numLength < 4){ for ($i=0;$i<4-$numLength;$i++){ $number .= '0'; } $number .=$num; }else{ $number .=$num; } return $number; }
csdn地址:https://blog.csdn.net/u010244476/article/details/84101881