Php Codeigniter set_flashdata returns页面不能仅在这台服务器上显示
好吧,这是个奇怪的问题。我刚刚将CodeIgniter代码移动到我客户的Web主机serverlogic.com。这段代码已经在40多台其他服务器上运行,但现在我突然遇到了麻烦。我正在使用数据库会话 这不起作用:Php Codeigniter set_flashdata returns页面不能仅在这台服务器上显示,php,codeigniter,session,cookies,Php,Codeigniter,Session,Cookies,好吧,这是个奇怪的问题。我刚刚将CodeIgniter代码移动到我客户的Web主机serverlogic.com。这段代码已经在40多台其他服务器上运行,但现在我突然遇到了麻烦。我正在使用数据库会话 这不起作用: $this->session->set_flashdata('contact_message', validation_errors()); $this->session->set_flashdata('first_name', $this->input-
$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()方法使用cookies来跟踪数据,因此,cookies中存储的数据过多时,是否会达到某些服务器限制?当调查我的服务器上的标题时,与此服务器相比,它设置了更多的cookie
我也从他们的服务器上得到了一个PHPSESSID cookie,但我不知道它是从哪里来的。我不是服务器管理员,因为他们在使用Nginx,所以我对此一无所知。您是否尝试过对每个flashdata集进行注释,以查看它是否是一个特定的语句?或者你是从评论中倒转过来的?还是你刚从zip开始 如果使用DB会话,存储会话数据的表的结构很重要。我能想到的唯一一件事是,您的列没有正确设置数据类型和存储的每一数据量的长度 可能会将表结构与服务器上定义的其他表进行双重检查 由于set_flashdata()方法使用cookies来跟踪数据,因此,cookies中存储的数据过多时,是否会达到某些服务器限制?当调查我的服务器上的标题时,与此服务器相比,它设置了更多的cookie 你刚才回答了你自己的问题 正如您所说,flashdata使用cookies存储数据,事实上只有这一台服务器意味着可能有两种情况
- 由于您的代码,此特定设置正在设置更多的数据(例如,您可能没有在其他设置中存储特定变量,而这些设置恰好将此设置推向边缘)
- 此服务器正在自行设置更多Cookie(nginx可能会这样),nginx对您的Cookie执行某种形式的内部重写也可能会出现问题,因此域问题会阻止Cookie正常工作,但这种可能性较小
你说你的页面无法显示错误,我的建议是,查看服务器日志,看看是否有任何错误。接下来,使用chrome developer工具或类似工具检查cookie,看看数据是否突然被切断。cookie只能存储如此多的信息,因此您可能会达到限制如果这是cookie限制,是否应该在所有设置中都发生?您证实了我的怀疑。显然,如果设置不正确,Nginx和cookies会出现一些问题。(大的客户端头缓冲区和/或代理缓冲区大小)。