Kyl*_*son 1 php alphanumeric automatic-properties
可以用php自动增加一个字母数字,所以它看起来像:
AB001
AB002
...
...
BA001
...
...
ZZ001
Run Code Online (Sandbox Code Playgroud)
然后需要将此代码添加到mysql中,我在想一个varchar(5).
干杯,
试试看吧
$x = 'AA998';
for($i = 0; $i < 10; $i++) {
echo $x++,'<br />';
}
Run Code Online (Sandbox Code Playgroud)
编辑
反转字母和数字
$x = '000AY';
for($i = 0; $i < 10; $i++) {
echo $x++,'<br />';
}
Run Code Online (Sandbox Code Playgroud)
或在ZZ999之后逆转
$x = 'ZZ998';
for($i = 0; $i < 10; $i++) {
$x++;
if (strlen($x) > 5)
$x = '000AA';
echo $x,'<br />';
}
Run Code Online (Sandbox Code Playgroud)