ユーザーが次のページに移動したときに検索クエリを取得できるように、flashdata を使用して検索クエリを保存しています。
これは、フラッシュデータを保存する方法です
$this->session->set_flashdata('searchQuery', $queryStr);
これは、フラッシュデータを取得する方法です。
$queryStr = $this->session->flashdata('searchQuery');
Flashdata はローカルでは正常に動作していますが、サーバーでホストすると、Chrome(Windows) と Chrome(Android) では動作しませんが、IE(Windows) では動作します。また、Chrome(iOS)でも問題なく動作します。テストケースも行いましたが、IE(Windows) と Chrome(iOS) でのみ動作します。誰が何が悪いのか知っていますか?
class Flashdata extends MY_Controller {
function __construct()
{
parent::__construct();
$this->load->library('session');
}
function index()
{
if ($var = $this->session->flashdata('test'))
{
echo "Found data: $var";
}
else
{
$this->session->set_flashdata('test', 'flash data test');
echo "Set data";
}
}
}
ここに私の.htaccessファイルがあります
# Options
Options -Multiviews
Options +FollowSymLinks
#Enable mod rewrite
RewriteEngine On
#the location of the root of your site
#if writing for subdirectories, you would enter /subdirectory
RewriteBase /
#Removes access to CodeIgniter system folder by users.
#Additionally this will allow you to create a System.php controller,
#previously this would not have been possible.
#'system' can be replaced if you have renamed your system folder.
RewriteCond %{REQUEST_URI} ^system.*
RewriteRule ^(.*)$ /index.php?/$1 [L]
#Checks to see if the user is attempting to access a valid file,
#such as an image or css document, if this isn't true it sends the
#request to index.php
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
#This last condition enables access to the images and css
#folders, and the robots.txt file
RewriteCond $1 !^(index\.php|images|robots\.txt|css)
RewriteRule ^(.*)$ index.php?/$1 [L]