首页 > Web开发 > 详细

PHP 生成唯一订单号

时间:2020-07-16 13:38:29      阅读:35      评论:0      收藏:0      [点我收藏+]
function orderNumer()
{
for ($i = 0; $i <= 701; $i++) {
$y = ($i / 26);
if ($y >= 1) {
$y = intval($y);
$yCode[] = chr($y + 64) . chr($i - $y * 26 + 65);
} else {
$yCode[] = chr($i + 65);
}
}
$orderSn = $yCode[intval(date(‘Y‘)) - 2012] . strtoupper(dechex(date(‘m‘))) .
date(‘d‘) . substr(microtime(), 2, 5) . sprintf(‘%02d‘, rand(0, 99)) . substr(implode(null, array_map(‘ord‘, str_split(substr(uniqid(), 7, 13), 1))), 0, 8);;
return $orderSn;
}

PHP 生成唯一订单号

原文:https://www.cnblogs.com/laowangbk/p/13321432.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!