當我運行我的PHP CodeIgniter的項目中,我得到這個錯誤信息:笨錯誤信息不能更改頭信息
A PHP Error was encountered
Severity: Warning
Message: Cannot modify header information - headers already sent by (output started at C:\AppServ\www\tree\application\models\mtree.php:17)
Filename: core/Common.php
Line Number: 442
線17:
echo $row->members_id . "</br>";
這是我的模型功能:
function convert_all() {
$this->db->empty_table('table1');
$this->db->empty_table('table2');
$this->db->query("INSERT INTO `table1` (`members_id`, `members_username`);
$query = $this->db->get('table2');
foreach ($query->result() as $row) {
if ($row->members_id > 1) {
echo $row->members_id . "</br>";
}
if ($this->isadvanced($row->members_id, $row->members_direct_id)) {
$this->insert_to_right($row, $row->members_direct_id);
} else {
$this->insert_to_left($row, $row->members_direct_id);
}
}
}
無關:您在本聲明結尾處缺少引號:* $ this-> db-> query(「INSERT INTO'table1'('members_id','members_username'); * –
將某些內容發送到用戶**在調用**之前添加到'header'函數。您提供的代碼沒有提供足夠的信息來幫助調試。閱讀更多關於錯誤的信息:http://php.net/manual/en/function.header.php – adeelx
看看這裏http://stackoverflow.com/questions/8028957/headers-al準備發送的PHP –