webman timestamp 时间乱码

workerman_dylan

截图

数据库:DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci
created_at timestamp NULL DEFAULT NULL,
updated_at timestamp NULL DEFAULT NULL,
deleted_at timestamp NULL DEFAULT NULL,

78 1 0
1个回答

yzh52521

illuminate/database 是吧?
自己去laravel 看文档

  • workerman_dylan 5天前

    laravel 【use DefaultDatetimeFormat;】webman不知道该如何处理

  • yzh52521 5天前
    namespace app\common\traits;
    
    use Carbon\CarbonInterface;
    use DateTimeInterface;
    
    trait DateFormat
    {
        protected function serializeDate(DateTimeInterface $date): string
        {
            return $date->format(CarbonInterface::DEFAULT_TO_STRING_FORMAT);
          //  return $date->format($this->dateFormat ?: 'Y-m-d H:i:s');
        }
    }

    model里
    use DateFormat;

🔝