我是php新手...我正在尝试在目录遍历脚本中维护会话...但是每次我去子目录时我的会话变量都会丢失...
现在我的脚本看起来像 -
start_session();
//login and authenticate using functions in included scripts
//(include(login.php);include(auth.php)) and set session variables accordingly
if (session variable is set)
{
//start the traversal script
}
所以我想知道的是如何在目录遍历中管理会话....任何人都可以帮助我...
答案 0 :(得分:0)
http://www.php.net/manual/en/function.session-start.php
session_start();
if (isset($_SESSION['directory_path'])) {
$directory_path = $_SESSION['directory_path'];
} else {
$directory_path = 'default/path';
}
// traverse with path
$_SESSION['directory_path'] = $new_directory_path;