【发布时间】:2011-09-09 18:29:33
【问题描述】:
我使用 CodeIgniter 1.7 开发的 Web 应用程序在仅使用 Chrome 浏览器打开时出现错误 ERR_RESPONSE_HEADERS_TOO_BIG。我尝试使用所有其他浏览器都不会发生错误。
我刷新错误页面后可以正常打开页面。我尝试从谷歌搜索,似乎这个错误从 2009 年到现在发生在 Chrome 用户身上。
这是我的控制器代码:
function search_daily_sales_summary_view()
{
if(!($this->session->userdata('DAILY_SALES_SUMMARY'))){
$this->session->set_flashdata('error', 'You dont have the permission to access that page.');
redirect('login/home');
}
$this->load->model('currency_model');
$this->load->model('bill_model');
$data = array();
$report = array();
if($query = $this->currency_model->list_currency())
{
foreach ($query as $row) {
$currencyid = $row->CURRENCY_ID;
$currencycode = $row->CURRENCY_CODE;
if($buyData = $this->bill_model->calculate_buy($currencyid))
{
$totalbuy = $buyData->total_from_amount;
$totalbuy_rate = $buyData->rate;
if($buyData->total_from_amount=='')
{
$totalbuy = 0.00;
}
if($buyData->rate=='')
{
$totalbuy_rate = 0.00;
}
}
else
{
$totalbuy = 0.00;
$totalbuy_rate = 0.00;
}
if($sellData = $this->bill_model->calculate_sell($currencyid))
{
$totalsell = $sellData->total_from_amount;
$totalsell_rate = $sellData->rate;
if($sellData->total_from_amount=='')
{
$totalsell = 0.00;
}
if($sellData->rate=='')
{
$totalsell_rate = 0.00;
}
}
else
{
$totalsell = 0.00;
$totalsell_rate = 0.00;
}
$report[] = array("currency"=>$currencycode, "buy"=>$totalbuy, "buyrate"=>$totalbuy_rate, "sell"=>$totalsell, "sellrate"=>$totalsell_rate);
}
$data['records'] = $report;
}
$this->load->model('company_model');
if($query = $this->company_model->list_company())
{
$data['company_list'] = $query;
}
$this->load->model('branch_model');
if($this->input->post('company'))
{
$companyid = $this->input->post('company');
if($query = $this->branch_model->view_company_branch($companyid))
{
$data['branch_list'] = $query;
}
}
else
{
if($query = $this->branch_model->list_branch())
{
$data['branch_list'] = $query;
}
}
$this->load->view('report/daily_sales_summary', $data);
}
如何解决?
【问题讨论】:
-
这很有趣。您是否尝试过查看标题以了解为什么(或是否)它们如此之大?使用 curl 很容易:
curl -I http://you_url_here/ -
我使用代码,这是我得到的输出:heypasteit.com/clip/Z5F 请注意,即使没有数据(意味着我搜索不存在的数据),错误仍然会发生。
-
哦,那是重定向。我们必须让 curl 跟随重定向。使用
-L选项再试一次:curl -I -L http://your_url_here/ -
好的,我按照你的指示,这里是输出:heypasteit.com/clip/Z5J
-
看起来 curl 被重定向到登录页面(因为它没有登录)。您可以尝试使用 Firebug 或 Web Inspector 查看标题。一些 Chrome 错误报告表明这是尝试在 CodeIgniter 会话中存储大型对象的结果。您应该考虑使用 CI 会话的目的,以及是否应该将这些数据存储在模型中。
标签: php codeigniter google-chrome