-1
喜每次IM刷新或點擊一個按鈕,刷新我的索引頁......這是我的主要頁面,會話死亡....這裏是一個簡單的代碼:PHP會話正在刷新爲什麼?
//session.class.php
<?php
session_start();
$_SESSION["EMAIL"] = "";
$_SESSION["LOGED"] = 0;
?>
//index.php
<?php
include_once ('session.class.php');
if (isset($_GET['login'])) {/// it a button submit in my form that use for login
$_SESSION["LOGED"] = 1;
include ("/module/Users/profile.php");// class that show profile if login an
// password is good
echo "session = ".$_SESSION["LOGED"];
}
if ($_SESSION["LOGED"] == 0) {
echo userFormLogin();//show login
echo "<a href=index.php?content=register>Register</a>";
}
?>
TY每一個: D
是什麼* 「會話死」 *實際上意味着什麼呢?當你包含'session.class.php'文件時,它會清除EMAIL屬性並將LOGED設置爲零嗎? – Phil 2014-10-22 00:26:40
這意味着當頁面刷新....我的會話變量重置爲0 .....所以它沒有看到我作爲一個用戶登錄日誌 – user3718713 2014-10-22 00:29:11
哼哼,我想這可能,但我不知道周圍的方式... 。如果它的概率我沒有idia如何設置會話變量爲零隻有一次,而不是覆蓋它... – user3718713 2014-10-22 00:30:26