我面临一个非常奇怪的问题,Codeigniter的闪存数据在十分之一的时间内不可用。大部分时间它的工作原理,但它是随机的。所以,有人可以帮助我知道这可能是什么原因。
控制器代码
public function set_pagelist(){
$site_id = $this->input->get('site_id');
$use_list = $this->input->get('use_list');
if($use_list=="1"){
$use_list = (int) $use_list;
}
$data = array("site_id" => $site_id,"page_list_option" => $use_list);
$url_send = $this->api_url."set_pagelist_option";
$str_data = json_encode($data);
$request = sendPostData($url_send, $str_data);
$response = json_decode($request, true);
$errors = $response['errors'];
$response_message = $response['response_message'];
if (isset($response_message) && isset($errors)) {
if (trim($response_message) === "Value Set" && trim($errors) === "None") {
$this->session->set_flashdata('upload_message', '<p><div class="alert-box success"><span>success: </span>Value has been set successfully</div></p>');
redirect("manage-domain");
} elseif($response_message === "Error" && $errors === "Invalid Pagelist Option") {
$this->session->set_flashdata('upload_message', '<p><div class="alert-box error"><span>Error: </span>Invalid Pagelist Option</div></p>');
redirect("manage-domain");
}
} else {
$this->session->set_flashdata('upload_message', '<p><div class="alert-box error"><span>Error: </span>OOPS some error occurred</div></p>');
redirect("manage-domain");
}
}
在视图中:
echo $this->session->flashdata('upload_message');
答案 0 :(得分:1)
我已经能够使用以下链接解决此问题Codeigniter flashdata not working in internet explorer and google chrome 分享的想法,因为它可以对某人有任何帮助