【发布时间】:2015-05-17 02:44:44
【问题描述】:
当我向新用户注册时,它总是将空值放入数据库。 也是对管理员和用户可见/隐藏的主题。请解决它 这是代码:
public function add() {
if ($this->request->is('post')) {
$this->User->create();
$this->request->data['User']['password'] = AuthComponent::password($this->request->data['User']['password']);
$this->request->data['User']['role'] === '1';
if ($this->User->save($this->request->data)) {
$this->Session->setFlash(__('The user has been saved.'));
return $this->redirect(array('action' => 'index'));
} else {
$this->Session->setFlash(__('The user could not be saved. Please, try again.'));
}
}
}
【问题讨论】:
标签: php cakephp model-view-controller blogs role