Php codeigniter:为什么这个模型会发出与codeigniter会话相关的严重警告问题?

Php codeigniter:为什么这个模型会发出与codeigniter会话相关的严重警告问题?,php,codeigniter,session,warnings,models,Php,Codeigniter,Session,Warnings,Models,模型如下: <?php class Generalfeaturesmodel extends CI_Model { protected $websitename; public function __construct() { parent::__construct(); $this-&g

模型如下:

    <?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;
    }
}   
?>   
下面是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行是文件的结尾(就在“?>”php标记之后)…我不知道这里可能出了什么问题???

在文件末尾保存换行符时,文件前面似乎有一个选项卡空间,因此没有输出

在文件末尾保存换行符时,文件前面似乎有一个选项卡空间,因此没有输出

空白?尝试删除
?>
正确!!非常感谢…我被发现了最古老的php问题lol…但是为什么在我的其他模型中,如果我离开关闭窗口?>警告不会发生?在任何模型中的php标记之前和之后都没有空格?您知道,如果将
log\u级别设置为debug,那么在尝试调试错误时,codeigniter会非常有帮助,这非常有帮助。顺便说一句,如果你已经解决了这个问题,请回答你自己的问题,这样其他人可能会知道一个空白?尝试删除
?>
正确!!非常感谢…我被发现了最古老的php问题lol…但是为什么在我的其他模型中,如果我离开关闭窗口?>警告不会发生?在任何模型中的php标记之前和之后都没有空格?您知道,如果将
log\u级别设置为debug,那么在尝试调试错误时,codeigniter会非常有帮助,这非常有帮助。顺便说一句,如果你已经解决了这个问题,回答你自己的问题,让别人知道
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
            );
}