重複の可能性:
PHP によって既に送信されたヘッダー
わかりませんが、しばらく前に、リダイレクト機能が機能していました。しかし、今ではこのエラーが表示されます:
Cannot modify header information - headers already sent by (output started at C:\xampp\htdocs\NewFolder\app\webroot\relationship1\app\controllers\books_controller.php:114) [CORE\cake\libs\controller\controller.php, line 744]
これは私のコントローラーです: C:\xampp\htdocs\NewFolder\app\webroot\trial\app\controllers\users_controller.php
<?php
class UsersController extends AppController{
function register(){
if(!empty($this->data)){
if($this->User->save($this->data)){
$this->Session->setFlash('Data saved');
$this->redirect(array('action'=>'index'));
} else{
$this->Session->setFlash('Could not save data');
}
} else{
$this->Session->setFlash('Please fill this form');
}
}
function index(){
$users = $this->User->find('all');
$this->set('users',$users);
}
function login(){
//$this->Session->write('user','chams');
//pr($this->Session->read());
if(!empty($this->data)){
//pr($this->data['User']['username']);
$username = $this->data['User']['username'];
//if($this->User->read(NULL,$username)){
//$condition = array('User.username'=>$username);
if($this->User->findByUserName($username)){
pr('existing');
$data = $this->User->find('first',$username);
$this->set('data',$data);
if($this->redirect(array('action'=>'main'))){
$this->Session->setFlash('redirected to index');
}
} else{
pr('non existing');
}
}
}
}
?>