这是我的登录页面的一部分,所有用于工作的内容我不确定是否更改导致错误的内容。当打印$ _SESSION它说数组,但是当我尝试打印$ _SESSION ['用户']像我保存在下面的代码中的数据它不会工作?
require("includes/connection.php");
echo $_SESSION;
echo $_SESSION['user'];
echo ' ';
if(empty($_SESSION['user']))
{}
登录页面的信息,当我打印的行显示阵列,但是当我改变页面的目标,并尝试打印会话上述不打印任何东西。
unset($row['salt']);
unset($row['password']);
echo $row['username'];
$_SESSION['user'] = $row;
启动会话http://php.net/manual/en/function.session-start.php并检查错误http://php.net/manual/en/function.error-reporting。 php –
另外,最好使用print_r()来查看变量的内容而不是echo – codisfy
请按照@codeHeart的建议添加print_r()。就在你有“echo $ _SESSION;”的地方添加“print_r($ _ SESSION);”。 – MyUser