YII2 表单提交不填则默认为null,如何设置为0,而不是Null [ 新手入门 ]
YII2 表单提交 $form->field($model, 'cate_pid') ,不填则默认为null,如何设置为0,而不是Null
$model->load(Yii::$app->request->post())
Integrity constraint violation – yii\db\IntegrityException
SQLSTATE[23000]: Integrity constraint violation: 1048 Le champ 'cate_pid' ne peut être vide (null)
The SQL being executed was: INSERT INTO `yii2b_category` (`cate_pid`, `cate_name`, `cate_title`, `cate_keywords`, `cate_description`, `cate_order`) VALUES (NULL, '测试', '测试', '测试', '测试', 55)
Error Info: Array
(
[0] => 23000
[1] => 1048
[2] => Le champ 'cate_pid' ne peut être vide (null)
)
↵
Caused by: PDOException
共 2 条回复
37364
注册时间:2016-10-31
最后登录:1970-01-01
在线时长:0小时0分
最后登录:1970-01-01
在线时长:0小时0分
- 粉丝4
- 金钱370
- 威望0
- 积分370