我做了一个 test.php 放在lifetype 下面和admin.php 一起的,这个test.php主要是用来负责自动产生登陆SESSION 的 现在问题是 我的 SESSION 的确是产生了 但是 只在test.php 里面可以看到 在 admin.php 里看不到 但是我新建立一个TEST1。PHP 也可以看到 请问是怎么回事?我那里设置错了么
test.php
<?
if (!defined( "PLOG_CLASS_PATH" )) {
define( "PLOG_CLASS_PATH", "F:\AppServ\www\lifetype/");
}
include_once( PLOG_CLASS_PATH."class/bootstrap.php" );
include_once( PLOG_CLASS_PATH."class/controller/admincontroller.class.php" );
include_once( PLOG_CLASS_PATH."class/net/http/session/sessionmanager.class.php" );
include_once( PLOG_CLASS_PATH."class/dao/userinfo.class.php" );
include_once( PLOG_CLASS_PATH."class/dao/users.class.php" );
include_once( PLOG_CLASS_PATH."class/dao/bloginfo.class.php" );
//include_once( PLOG_CLASS_PATH."class/plugin/pluginmanager.class.php" );
//include_once( PLOG_CLASS_PATH.'class/template/templatesets/templatesets.class.php' );
include_once( PLOG_CLASS_PATH."class/action/action.class.php" );
include_once( PLOG_CLASS_PATH."class/view/admin/admindashboardview.class.php" );
include_once( PLOG_CLASS_PATH."class/view/admin/admindefaultview.class.php" );
include_once( PLOG_CLASS_PATH."class/dao/users.class.php" );
//include_once( PLOG_CLASS_PATH."class/dao/blogs.class.php" );
include_once( PLOG_CLASS_PATH."class/net/http/session/sessioninfo.class.php" );
include_once( PLOG_CLASS_PATH."class/config/config.class.php" );
include_once( PLOG_CLASS_PATH."class/misc/version.class.php" );
include_once( PLOG_CLASS_PATH."class/locale/locales.class.php" );
include_once( PLOG_CLASS_PATH."class/data/validator/stringvalidator.class.php" );
include_once( PLOG_CLASS_PATH."class/view/admin/adminnewpostview.class.php" );
ini_set("arg_seperator.output", "&");
ini_set("magic_quotes_runtime", 0 );
// initialize the session
SessionManager::init();
// 產生一個新的 user 物件
$users = new Users();
// 取得 userInfo 物件 (透過正確的 username 與 password)
$userName="test5";
$userPassword="111111";
$userInfo = $users->getUserInfo( $userName, $userPassword );
// 取得使用者的 blog list
$userBlogs = $users->getUsersBlogs( $userInfo->getId(), BLOG_STATUS_ACTIVE );
// 用第一個 blog 來當作 blogID,並取得這個 blog ID 的 blogInfo
$blogInfo = end( $userBlogs );
// 取得 session
//echo "<pre>";
$session = HttpVars::getSession();
$sessionInfo = $session["SessionInfo"];
// 並且把資料寫入session
$sessionInfo->setValue( "userInfo", $userInfo );
$sessionInfo->setValue( "blogInfo", $blogInfo );
$session["SessionInfo"] = $sessionInfo;
HttpVars::setSession( $session );
echo "<pre>";print_R($_SESSION);
?>