[英]$_SESSION Error array is not printing
This is part of my login page, everything used to work I'm not sure if i changed something that caused an error.这是我登录页面的一部分,过去一切正常,我不确定我是否更改了导致错误的内容。 When printing the $_SESSION it says array but when i try to print $_SESSION['user'] like i saved the data in the code below it will not work???
打印 $_SESSION 时,它显示数组,但是当我尝试打印 $_SESSION['user'] 时,就像我将数据保存在下面的代码中一样,它不起作用???
require("includes/connection.php");
echo $_SESSION;
echo $_SESSION['user'];
echo ' ';
if(empty($_SESSION['user']))
{}
login page info, when i print the row is shows the array but when i change the page destination and try to print above the session is not printing anything.登录页面信息,当我打印该行时显示数组,但是当我更改页面目标并尝试在会话上方打印时不打印任何内容。
unset($row['salt']);
unset($row['password']);
echo $row['username'];
$_SESSION['user'] = $row;
add this in first line;在第一行添加这个;
ob_start();
session_start();
You need to use session_start();
您需要使用
session_start();
at the top and $_SESSION
is an array, you cant use echo
, so you need to use print_r($_SESSION);
在顶部和
$_SESSION
是一个数组,你不能使用echo
,所以你需要使用print_r($_SESSION);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.