В CakePHP, после того как я сохранил значение в базе данных, я пытаюсь перенаправить страницу к действию index в контроллере пользователей с этим кодом:
function add(){
if (!empty($this->data)) {
if ($this->User->save($this->data['User'])) {
// $this->User->Post->date=$this->data['Post']['date1'];
// $this->data['Post']->;
// echo $this->User->Post->user_id;
$this->User->Post->set($this->data['Post']);
$this->User->Post->set('user_id' ,$this->User->getInsertID());
if ($this->User->Post->save()) {
// $this->Session->setFlash('Your post has been saved.');
$this->redirect(array('action'=>'index'));
echo "test";
}
}
}
}
Я получаю эту ошибку:
Warning (2): Cannot modify header information - headers already sent by (output started at C:\xampp\htdocs\students\app\controllers\users_controller.php:1) [CORE\cake\libs\controller\controller.php, line 742]