2012-02-12 29 views
1

好吧,这是一个奇怪的。我刚刚将CodeIgniter代码移到了我的客户端的虚拟主机serverlogic.com上。该代码一直在处理超过40个其他服务器,但现在突然间我正在进入墙壁。我正在使用数据库会话。Codeigniter set_flashdata返回页面无法显示在这台服务器上

这不起作用:

$this->session->set_flashdata('contact_message', validation_errors()); 
$this->session->set_flashdata('first_name', $this->input->post('first_name')); 
$this->session->set_flashdata('last_name', $this->input->post('last_name')); 
$this->session->set_flashdata('email', $this->input->post('email')); 
$this->session->set_flashdata('zip', $this->input->post('zip')); 
$this->session->set_flashdata('phone', $this->input->post('phone')); 
$this->session->set_flashdata('comments', $this->input->post('comments')); 

这工作:

$this->session->set_flashdata('contact_message', validation_errors()); 
$this->session->set_flashdata('first_name', $this->input->post('first_name')); 
$this->session->set_flashdata('last_name', $this->input->post('last_name')); 
$this->session->set_flashdata('email', $this->input->post('email')); 
/*$this->session->set_flashdata('zip', $this->input->post('zip')); 
$this->session->set_flashdata('phone', $this->input->post('phone')); 
$this->session->set_flashdata('comments', $this->input->post('comments'));*/ 

由于set_flashdata()方法使用Cookie来跟踪数据,会不会是有一些服务器限制一旦cookie中存储了太多数据,就会触发这种情况?当调查我的服务器上的标题时,它将与此服务器相比设置更多Cookie。

我也从他们的服务器获取PHPSESSID cookie,但我不知道它来自哪里。我不是服务器管理员,因为他们使用Nginx我完全在这个黑暗中。

+0

饼干只能存储这么多的信息,所以你可能达到极限 – Henesnarfel 2012-02-12 01:52:44

+0

如果这将是cookie的限制,这不应该发生在所有的设置? – qwertzman 2012-02-13 16:21:40

回答

0

由于set_flashdata()方法使用cookie来跟踪数据,可能是因为cookie中存储的数据太多而导致存在一些服务器限制?当调查我的服务器上的标题时,它将与此服务器相比设置更多Cookie。

你刚才已经回答你自己的问题,

正如你所说flashdata使用Cookie来存储数据,事实上,它是仅此一台服务器意味着两件事情的可能性。

  • 这种特殊的设置是更多的数据设置,由于你的代码(例如,你可能不被存储在您的其他设置一个特定的变量,它恰好是这翻倒在边缘)。

  • 这个服务器本身设置了更多的cookie(这可能与nginx有关),它也可能是nginx在你的cookies上做某种形式的内部重写的一个问题,所以域问题会阻止cookies正常工作,但这是不太可能的。

你说,你会得到一个页面无法显示错误,我的建议,看看服务器日志,看看是否有任何错误。接下来使用Chrome开发人员工具或类似工具检查cookie,看看数据是否突然中断。

+0

你证实了我的怀疑。很明显,如果Nginx和cookie设置不当,会出现一些问题。 (large_client_header_buffers和/或proxy_buffer_size)。 – qwertzman 2012-02-13 16:16:55

0

您是否尝试过注释每个set_flashdata以查看它是否是一个特定语句?还是你从评论中倒退?或者你刚刚开始使用zip?

如果您使用的是DB会话,那么会话数据存储在其中的表的结构非常重要。我唯一能想到的就是你的列没有正确设置数据类型和每个数据存储的长度。

也许用您在服务器上定义的其他表格重新检查表结构。

相关问题