As shown below:
<strong><span style="font-size:18px;">/*编号=年份后两位+月份+id四位数*/ $id = $this->student_model->save(0, $data); $sn = date('Y', time()); $sn = substr($sn, -2); $sn.= date('m', time()); $sn.=sprintf("%04d", $id);</span></strong>
[Result Preview] Example: 14120001
The above is the php basis that the editor has brought to you This is all about the implementation method of automatically generating numbers from data IDs. I hope everyone will support the PHP Chinese website~
For more articles related to the implementation methods of automatically generating numbers based on data IDs in PHP, please pay attention to the PHP Chinese website!