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/