PHP 和 session : how get an associative array from a session variable?

标签 php

Possible Duplicate:
Able to see a variable in print_r()'s output, but not sure how to access it in code

我需要与连接的用户一起处理现有网站:

<?php session_start();
print_r($_SESSION); ?>

此代码输出:

Array([%http_user%] => Array
    (
        [profile_id] => 72
        [username] => john
        [session_id] => 4ek79umrrpael7vvb4ls3diaq4
    )

[registration_invite_code] => 

)

这就是我需要的。它试图让“john”进入我的$username变量:

知道怎么做吗?

我尝试过:

$_SESSION[0]

$_SESSION["%http_user%"]

$_SESSION->username

没办法。

有办法找回这个用户名吗?

谢谢

最佳答案

$variable = $_SESSION['%http_user%']['用户名'];

关于PHP 和 session : how get an associative array from a session variable?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13279794/

相关文章:

php - cron作业php中的无限循环

PHP cookie 写入不正确的域

php - 使用 MySQL 选择查询 7 Complete Days ago 记录

php - POST 到 Laravel Passport 路由以创建客户端时出现 419 错误

php - 我的 cronjob 不工作?

php - 在 PHP 中使用从 jQuery 发送的 JSON 对象

php - 如何从 PHP 中的时间范围(昨天,过去 30 天)中获取 SQL 行数

PHP flock函数限制和txt缓存文件

php - 仅在需要时更新 MySQL 行

php - 合并mysql表中的多个 'orders'并显示总价?