1
我在重定向時遇到了問題。我正在使用威廉姆斯模板庫。除了重定向之外,一切工作都會發現。用戶點擊註銷按鈕後仍可以訪問主頁。這裏是我的代碼:在模板庫中未正確重定向 - Codeigniter
頁面控制器:
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();
}
}
我已經殺了會議,但是當用戶點擊「返回」按鈕,主頁還是可以的被觀看。但如果用戶刷新頁面,則代碼將按預期工作。
請幫助
CI似乎沒有問題。這是正確的行爲,您在註銷後單擊後退按鈕時看到的頁面是您的瀏覽器緩存的副本。讓我知道如果這個鏈接幫助:http://stackoverflow.com/questions/8004534/avoid-go-back-after-logout – 2012-01-16 08:44:59
這個問題也應該幫助你在正確的方向http://stackoverflow.com/questions/ 8860953 /笨 - 會話問題/ 8864252#8864252 – 2012-01-26 07:34:05