我在操作中使用此代码注册新用户:
public function register() {
$this->set('title_for_layout', 'Register');
if ($this->request->is('post')) {
$this->User->create();
if ($this->User->save($this->request->data)) {
$this->Session->setFlash('Your account has been created. You may now login with your username and password.', 'default', array('class' => 'success-flash'));
$this->redirect(array('action' => 'register'));
} else {
$this->Session->setFlash('There was an error creating your account.', 'default', array('class' => 'error-flash'));
}
}
}
但是,regisered
我的数据库用户表中的字段始终是0000-00-00 00:00:00
. 如何让 Cake 在此字段中插入正确的日期?谢谢。