我想要一個$_SESSION
價值,它只是在一個普通的頁面。如果我使用開關/外殼,我無法獲得該值。有人能幫助我嗎?
開關/箱:
switch($_GET['act'])
{
case 'login':
include('./include/login.php'); break;
case 'logout':
include('./include/logout.php'); break;
case 'help':
include('./include/help.php'); break;
case 'help2':
include('./include/help.php'); break;
case 'contact':
include('./include/contat.php'); break;
case 'admin':
include('./include/admin.php'); break;
case 'moderate':
include('./include/moderate.php'); break;
case 'check':
include('./include/check.php'); break;
case 'belevki':
include('./include/belevki.php'); break;
case 'register':
include('./include/register.php'); break;
case 'ls':
include('./include/ls.php'); break;
case 'los':
include('./include/los.php'); break;
case 'profile':
include('./include/profile.php'); break;
case 'srok':
include('./include/check1visrok.php'); break;
default: // разглеждане на index-a
include('./include/index.php');
}
這就是我想打從創建會話
$egn = $_POST['student'];
validegn($egn);
$_SESSION['favcolor'] = $egn;
header("location:../index.php");
的鏈接代碼,這是我想最後一頁當您通過header('location: ../index.php)
做一個重定向到顯示值
$egn = $_SESSION['favcolor'];
echo $_SESSION['favcolor'];
也許你需要在訪問var之前啓動會話? @session_start(); – Vygandas
我有session_start();到處 – user3315719