生成唯一的订单号

admin8个月前Laravel389

public function get_order_sn()
{
    return date('Ymd') . substr(implode(NULL, array_map('ord', str_split(substr(uniqid(), 7, 13), 1))), 0, 8);
}

$orderid = date("Ymdhis") . sprintf("%08d", $this->user_id) . mt_rand(1000, 9999);


返回列表

没有更早的文章了...

下一篇:公众号登录

相关文章

设置项目编号

$max = Db::table('member')->max('id') ?? 0; if ($max < 100000) { $cd = $this->create...

发送公众号信息

* 发送消息 */public function tosend($openid, $title, $content, $time, $aid){    $tokens = $thi...

抖音小程序码

public function dyqrcode($uid){    $url = "https://open.douyin.com/api/apps/v1/qrcode...

php 优化

使用 gc_collect_cycles() 强制进行垃圾回收 PHP 的垃圾回收机制会自动释放不再使用的变量所占用的内存。然而,在某些情况下,尤其是在长时间运行的脚本(如 CLI...

PHP 严格类型

只需在 PHP 代码文件的开头加上declare(strict_types = 1);这一行魔法代码,就能开启严格类型检查之旅。...

获取域名

/** * 获取域名 */public function domain(){    return request()->getSchemeAndHttpHost();}...