gpt4 book ai didi

php - 十月 cms,无法保存具有空值的模型

转载 作者:行者123 更新时间:2023-12-04 16:01:05 26 4
gpt4 key购买 nike

我创建模型,有列:

like4u_id、vtope_id、panel_id

我设置了这些列选项 - 可为空,但如果我保存模型,我会收到错误消息:

SQLSTATE[HY000]: General error: 1366 Incorrect integer value: '' for column 'like4u_id' at row 1 (SQL: update master_vars set updated_at = 2018-05-23 16:03:14, like4u_id = , vtope_id = where id = 328)

问题是什么?它是不需要的字段并且列可以为空..

最佳答案

MySQL 数据库可能会发生这种情况。您需要在模型中使用 Nullable 特性,以便在留空时将属性设置为 NULL。

这是 docs可空特性的

关于php - 十月 cms,无法保存具有空值的模型,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50492982/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com