【问题标题】:CodeIgniter session work my wamp server properly, But online server does not workCodeIgniter 会话正常工作我的 wamp 服务器,但在线服务器不工作
【发布时间】:2014-04-26 23:35:31
【问题描述】:

现在,我开发了一个用于医疗的 CodeIgniter 应用程序 服务网站。有一个聊天选项。对于这个聊天功能,我创建了 Session。 配置文件代码

$config['encryption_key'] = 'CoderSaiful';
$config['sess_cookie_name']     = 'ci_session';
$config['sess_expiration']      = 7200;
$config['sess_expire_on_close'] = FALSE;
$config['sess_encrypt_cookie']  = FALSE;
$config['sess_use_database']    = FALSE;
$config['sess_table_name']      = 'ci_sessions';
$config['sess_match_ip']        = FALSE;
$config['sess_match_useragent'] = TRUE;
$config['sess_time_to_update']  = 300;

自动加载文件代码:

$autoload['libraries'] = array('database','form_validation','session');

控制器chat.php文件代码:

function index(){
$user_data = $this->session->all_userdata();
$data['title'] = 'Live Chat';
$data['sub_title'] = 'Chat with each other and free';;
$this->load->model('options_m');
$data['menu']=  $this->options_m->menu(); 
$data['site_info']=  $this->options_m->site_info();
$this->load->view('template/header_with_menu_with_top',$data);

            if(isset($user_data[0])){
//enter code here
            }
            else{
                $this->load->view('chat/form');  
            }
        /*
        $this->load->view('chat/form');

        $this->load->model('chat_m');
        $data['chat'] = $this->chat_m->get_chat();
        */

        $this->load->model('chat_m');
        $data['chat'] = $this->chat_m->get_chat();
        $this->load->view('chat/live',$data);

        if(isset($user_data[0])){
              $this->load->view('chat/chat_form',$user_data);   
            }

        $this->load->view('includes/footer');
        //dump($data);
    }

我认为,当我检查我的本地 pc wamp 服务器时,一切都正确并且工作正常。但是当我上传到我的网络服务器时。它显示错误。像这样:

Severity: Warning <br>

Message: Cannot modify header information - headers already sent by (output started at /home/saifulbd/public_html/jessorepublichealth.com/application/controllers/chat.php:1)<br>

Filename: libraries/Session.php<br>

Line Number: 675<br>

现在我想为这个错误找到很好的解决方案。

【问题讨论】:

  • 查看此链接希望对您有所帮助stackoverflow.com/questions/15974891/…
  • 请注意,标头应在其他任何内容之前发送。确保在 header 函数之前没有代码/html 甚至空格/缩进,并且在您的视图中第一个开始 php 标记 之前没有任何内容。

标签: php codeigniter session continuous-integration


【解决方案1】:

它适用于您的本地开发平台

我看过你很多检查过的两件事是

文件系统路径配置

.htaccess 如果你有一个

从您的声明中可以看出,您的 ftp 目录是

/home/saifulbd/public_html/ci_folder/

仅从 wampp 开始

/www/ci_folder

【讨论】:

  • 感谢您的回复。但我不明白你的解决方案。所以我无法解决这个问题。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2010-09-29
  • 1970-01-01
  • 1970-01-01
  • 2016-12-30
  • 2011-11-11
  • 2013-08-10
相关资源
最近更新 更多