リダイレクトに問題がありました。ウィリアムズのテンプレートライブラリを使用しています。リダイレクト以外はすべて動作します。ホーム・ページは、ログアウト・ボタンをクリックした後でもユーザーがアクセスできます。ここに私のコードは次のとおりです。テンプレートライブラリで正しくリダイレクトされていません - コード番号
ページコントローラ:
class Page extends CI_Controller {
function index()
{
$this->load->helper('form');
$this->template->write_view('header','header');
$this->template->write_view('content','login');
$this->template->write_view('sidebar','sidebar');
$this->template->render();
}
}
ホームコントローラ:
class Home extends CI_Controller
{
function __construct()
{
parent::__construct();
$this->load->library('session');
$this->load->model('user_model','check',TRUE);
if(!$this->check->checkUserLogin())
{
redirect('page');
}
}
function index()
{
$this->template->write_view('header','header');
$this->template->write_view('content','home');
$this->template->write_view('sidebar','sidebar');
$this->template->render();
}
}
私はすでにセッションを殺すが、ユーザが「戻る」ボタン、ホームページをクリックすると、まだすることができ見ることができる。ユーザーがページをリフレッシュすると、コードは期待通りに機能します。
あなたは、あなたのHTMLのheadセクション内のコードの2次の行のいずれかを使用してみてください
CIでは問題はないようです。これは正しい動作です。ログアウトした後に表示されるページは、ブラウザによってキャッシュされたコピーです。このリンクが役立つかどうか私に教えてください:http://stackoverflow.com/questions/8004534/avoid-go-back-after-logout –
この質問は正しい方向にも役立ちますhttp://stackoverflow.com/questions/ 8860953/codeigniter-session-problems/8864252#8864252 –