这是模型:
<?php
class Generalfeaturesmodel extends CI_Model
{
protected $websitename;
public function __construct()
{
parent::__construct();
$this->websitename = 'GameSwap';
}
// helper function that retrieves all the data from the specified table. Basically since this is in the swap account model
// only use it for swap account related tables, not membership related tables for instance.
public function getdetails($tablename)
{
$query = $this->db->get($tablename);
$allrows = array();
$i=0;
foreach($query->result_array() as $row)
{
$allrows[$i++]=$row;
}
return $allrows;
}
// returns all the games based on the query conditions.
// @conditions - an associative array containing the conditions for the query.
// returns an array with all the games based on the where clauses.
public function gettargetswaps($where)
{
$query = $this->db->get_where('swaps',$where);
$targetswaps = array();
$i = 0;
foreach($query->result_array() as $s)
{
$query = $this->db->get_where('games',array('id'=>$s['gameid']));
$details = $query->row_array();
$gamedetails = array('name'=>$details['name'],'consoleid'=>$details['consoleid'],'genreid'=>$details['genreid'],'imgurl'=>$details['imgurl']);
$targetswaps[$i] = array_merge($s,$gamedetails);
$i++;
}
return $targetswaps;
}
}
?>
基本上是继承人是我加载上述模型时得到的错误:
A PHP Error was encountered
Severity: Warning
Message: Cannot modify header information - headers already sent by (output started at /home/phpgod/public_html/johnnyarias/ci_website/application/models/generalfeaturesmodel.php:50)
Filename: libraries/Session.php
Line Number: 672
这里是Session.php文件中抛出/或与错误有关的函数:
function _set_cookie($cookie_data = NULL)
{
if (is_null($cookie_data))
{
$cookie_data = $this->userdata;
}
// Serialize the userdata for the cookie
$cookie_data = $this->_serialize($cookie_data);
if ($this->sess_encrypt_cookie == TRUE)
{
$cookie_data = $this->CI->encrypt->encode($cookie_data);
}
else
{
// if encryption is not used, we provide an md5 hash to prevent userside tampering
$cookie_data = $cookie_data.md5($cookie_data.$this->encryption_key);
}
$expire = ($this->sess_expire_on_close === TRUE) ? 0 : $this->sess_expiration + time();
// Set the cookie
setcookie(
$this->sess_cookie_name,
$cookie_data,
$expire,
$this->cookie_path,
$this->cookie_domain,
$this->cookie_secure
);
}
GeneralFeaturesmodel中的第50行是文件的结尾(紧跟在'?&gt;'php标签之后)......我不知道这里会出现什么问题???
答案 0 :(得分:0)
似乎也是你的&lt;?php前面的标签空间,正如Damien所提到的那样,离开结束会更安全吗?&gt;因此,如果在文件末尾保存换行符,则没有输出