PHP,print_r($_SESSION) 不显示其内容? [英] PHP, print_r($_SESSION) doesn't show its content?

查看:50
本文介绍了PHP,print_r($_SESSION) 不显示其内容?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想用命令 print_r($_SESSION) 查看数组 $_SESSION 的内容,但我得到的只是以下输出:

数组()

我错过了什么?

谢谢

解决方案

确保在您希望使用会话的所有页面的顶部调用 session_start().

http://php.net/manual/en/function.session-启动.php

";打印_r($_SESSION);echo "</pre>";?>

I want to see the content of the the array $_SESSION with the command print_r($_SESSION) but what I get is just the following output:

Array ()

what am I missing ?

thanks

解决方案

Make sure you call session_start() at the top of all the pages you wish to use the session.

http://php.net/manual/en/function.session-start.php

<?php

session_start();

echo "<pre>";
print_r($_SESSION);
echo "</pre>";

?>

这篇关于PHP,print_r($_SESSION) 不显示其内容?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆