【发布时间】:2011-12-01 15:51:40
【问题描述】:
如何为模型中的字段设置默认值?
编辑:
我已经按照建议尝试了使用 _schema 的方法,但没有使用默认值。
public $_schema = array(
'newsletter' => array(
'default' => 1
),
);
【问题讨论】:
-
是什么阻止您在数据库中执行此操作?
-
我已经尝试过链接中描述的方法,但似乎无法正常工作。
-
@freshest 哪种方法?在 Google 上搜索?
-
@elitalon _schema 方法。
-
@freshest 试试这个:snook.ca/archives/cakephp/cakephp_setting
标签: cakephp