为 UsersController 编写 add() 函数时出现问题。
public function add(){
if ($this->request->is('post')) {
if ($this->User->save($this->request->data)) {
$this->Session->setFlash('The new user has been saved.');
$this->redirect(array('action' => 'test'));
}
}
$this->set('title_for_layout', 'Register');
}
这是添加视图 ctp。
<?php
echo $this->Form->create('User');
echo $this->Form->input('username');
echo $this->Form->input('password');
echo $this->Form->end('Save User');
?>
当我尝试访问用户/添加时总是出现内部错误。有谁知道如何处理这个问题?谢谢。