2012-02-12 24 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會話,那麼會話數據存儲在其中的表的結構非常重要。我唯一能想到的就是你的列沒有正確設置數據類型和每個數據存儲的長度。

也許用您在服務器上定義的其他表格重新檢查表結構。

相關問題