dszsajhd237437 2012-01-18 10:17
浏览 78

可以print_r $ _SESSION对象,但无法访问它?

First, a bit of background info. I'm working on a multi-site project, 3 cities each with their own installation of a custom CMS type thing. The client doesn't want to pay out for more than one SSL certificate, and despite my suggestion won't even look into a wildcard SSL. My job is to create a unified payment gateway that sits on domain.com/paypment.php, the sites themselves sit on subdomains e.g cityx.domain.com.

Now, on the original payment page the code accesses an object created by the CMS called $_SESSION['member_obj'], and at some point in the code detects the user's account level using:

if ($_SESSION['member_obj']->data['account_level']==1)

So, this works all fine and dandy without any problems, but as soon as I use the same object on my script it breaks. I would like to point out that my code is sitting on the root domain, and the working code on a sub - I have made the $_SESSION variables available to all subdomains using:

ini_set('session.cookie_domain', '.domain.com');

Now, the odd part, the object exists but when I try to use the ->data['account_level'] method, it dies on me. I know the object exists becasue I can print_r the object and I get the following:

__PHP_Incomplete_Class Object
(
    [__PHP_Incomplete_Class_Name] => Member
    [table] => members
    [data] => Array
    (
        [id] => 1689
        [title] => mr
        [firstname] => Testy
        [surname] => McTesters
        [age_range] => 18-24
        [gender] => male
        [email] => xxxxxx
        [username] => xxxxxx
        [password] => xxxxxx
        [account_level] => 1
        [joined] => 1326290317
        [password_reset] => 
        [password_reset_date] => 01/01/1970
        [last_active] => 1326881531
        [status] => active
        [contact] => 0
        [third_party] => 0
        [notifications] => 0
        [terms] => 1
        [dummy] => 0
        [override_account] => 0
        [premium_request] => 1
        [password_reset_date_original] => 1970-01-01
    )

followed by a load of other stuff.

So, could anyone be kind enough to explain to me how an object can exist, but not be accessible?

  • 写回答

2条回答 默认 最新

  • duanji9378 2012-01-18 10:20
    关注

    You will have to load the class Member prior to starting the session.

    Check so your session.auto_start is set to off in your php.ini.

    评论

报告相同问题?

悬赏问题

  • ¥100 set_link_state
  • ¥15 虚幻5 UE美术毛发渲染
  • ¥15 CVRP 图论 物流运输优化
  • ¥15 Tableau online 嵌入ppt失败
  • ¥100 支付宝网页转账系统不识别账号
  • ¥15 基于单片机的靶位控制系统
  • ¥15 真我手机蓝牙传输进度消息被关闭了,怎么打开?(关键词-消息通知)
  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
  • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
  • ¥15 手机接入宽带网线,如何释放宽带全部速度