歡迎光臨, 訪客. 請先 登入註冊一個帳號.
四月 20, 2024, 08:55:39 下午
19595 文章 在 3865 主題 由 4580 會員
最新註冊會員: aa123aa1
LifeType 中文開發論壇  |  測試  |  LifeType 1.1 測試  |  为什么取不得session中的变量 « 上篇主題 下篇主題 »
頁: [1]
作者 主題: 为什么取不得session中的变量  (閱讀 12282 次)
genesoul
新手見習
*
文章: 5


檢視個人資料
« 於: 七月 08, 2006, 10:40:11 上午 »

我从admin.php登录以后,然后转到 我的test.php,但是取不到 user 的id 和name, test.php 的code如下:


<?php
 if (!defined( "PLOG_CLASS_PATH" )) {
        define( "PLOG_CLASS_PATH", dirname(__FILE__)."/");
    }

    include_once( PLOG_CLASS_PATH."class/bootstrap.php" );     
    include_once( PLOG_CLASS_PATH."class/summary/controller/summarycontroller.class.php" );
    include_once( PLOG_CLASS_PATH."class/net/http/httpvars.class.php" );
    include_once( PLOG_CLASS_PATH."class/misc/version.class.php" );
    include_once( PLOG_CLASS_PATH."class/data/validator/usernamevalidator.class.php" );
   include_once( PLOG_CLASS_PATH."class/net/http/subdomains.class.php" );
   include_once( PLOG_CLASS_PATH."class/net/http/session/sessionmanager.class.php" );   

   SessionManager::init();
   $userInfo = &SessionManager::getSessionValue("userInfo");

/*
 * Created on 2006-7-8
 *
 * To change the template for this generated file go to
 * Window - Preferences - PHPeclipse - PHP - Code Templates
 */
?>

<html>
<head>
   <title> test
   
   </title>
   
</head>

<?
   echo $userInfo->getId();
   echo $userInfo->getUsername();
 ?>
 
</html>


我用的是LT 1.1 。



« 最後編輯時間: 七月 08, 2006, 10:59:29 上午 由 genesoul » 已記錄
lss
我不是被~拉~~出來的,不要叫我大大!
總版主
超級會員
*****
文章: 1511



檢視個人資料 個人網站
« 回覆文章 #1 於: 七月 08, 2006, 10:55:17 上午 »

bootstrap.php 好像是 1.1 才開始提供的功能。

請確定你是使用 LT 1.1 。

若是 1.1 的問題,目前來說,請移至 LifeType 1.1 測試版討論。

lss
已記錄

沒找過 常見問題集或不知道 如何在 LifeType 中文開發論壇發問的人,恕不回答問題
markwu
系統管理員
超級會員
*****
文章: 3928


Mark Wu


檢視個人資料 個人網站
« 回覆文章 #2 於: 七月 08, 2006, 12:32:38 下午 »

下一次請把錯誤訊息一起列出來,這樣要查比較快。

原因是因為你少 include 了 userinfo.class.php,請參考:

<?php
if (!defined"PLOG_CLASS_PATH" )) {
        
define"PLOG_CLASS_PATH"dirname(__FILE__)."/");
    }

   include_once( 
PLOG_CLASS_PATH."class/bootstrap.php" );     
   include_once( 
PLOG_CLASS_PATH."class/net/http/session/sessionmanager.class.php" ); 
   include_once( 
PLOG_CLASS_PATH."class/dao/userinfo.class.php" );

   
SessionManager::init();
   
$userInfo = &SessionManager::getSessionValue("userInfo");

/*
* Created on 2006-7-8
*
* To change the template for this generated file go to
* Window - Preferences - PHPeclipse - PHP - Code Templates
*/
?>

<html>
<head>
   <title> test
   
   </title>
   
</head>

<?
   
echo $userInfo->getId();
   echo 
$userInfo->getUsername();
?>

</html>

Mark
« 最後編輯時間: 七月 08, 2006, 12:34:44 下午 由 markwu » 已記錄

genesoul
新手見習
*
文章: 5


檢視個人資料
« 回覆文章 #3 於: 七月 08, 2006, 03:03:30 下午 »

非常感谢mark
已記錄
頁: [1]
LifeType 中文開發論壇  |  測試  |  LifeType 1.1 測試  |  为什么取不得session中的变量 « 上篇主題 下篇主題 »
    前往: