TP5 提示 A non well formed numeric value encountered

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/li_haijiang/article/details/82181326

数据表字段是create_time timestamp 默认:CURRENT_TIMESTAMP

使用时间会出现以下错误:

A non well formed numeric value encountered

这是因为tp5框架会自动转换时间

class UserModel extends Model
{
    protected $pk = 'id';//主键
    //设置当前模型对应的完整数据表名称
    protected $table = 'user';
//-------------------
    protected $auto = ['create_time'];
    public function getCreateTimeAttr($time)
        {
            return $time;
        }
//-------------------

猜你喜欢

转载自blog.csdn.net/li_haijiang/article/details/82181326
今日推荐