限时免费试用:欢迎注册 api.bigmodel.org ,快速体验大模型 API 接入服务。
当前位置:首页 >开发者 >网站框架 >后端框架 >ThinkPHP

TP5错误 | A non well formed numeric value encountered

分类:ThinkPHP时间:2018-04-30浏览:5862
数据表字段是create_time timestamp 默认:CURRENT_TIMESTAMP 使用时间会出现以下错误: A non well formed numeric value encountered 这是因为tp5框架会自动转换时间 解决方案如下:
class powerModel extends Model
{
    protected $pk = 'id';//主键
    //设置当前模型对应的完整数据表名称
    protected $table = 'pre_power';
//-------------------
    protected $auto = ['create_time'];
    public function getCreateTimeAttr($time)
        {
            return $time;
        }
//-------------------
本站文章如未注明出处均为原创,转载请注明出处,如有侵权请邮件联系站长。
0/500
Share your thoughts respectfully.