如何打印当前设置的所有会话变量? [英] How to print all session variables currently set?

查看:73
本文介绍了如何打印当前设置的所有会话变量?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

不必按名称调用每个会话变量,是否可以显示当前设置的所有会话变量的内容?

Without having to call each session variable by name, is there a way to display the content of all the session variables currently set?

推荐答案

echo '<pre>';
var_dump($_SESSION);
echo '</pre>';

或者如果您不关心类型,则可以使用print_r.如果使用print_r,则可以将第二个参数设置为TRUE,这样它将返回而不是回显,这对于...很有用.

Or you can use print_r if you don't care about types. If you use print_r, you can make the second argument TRUE so it will return instead of echo, useful for...

echo '<pre>' . print_r($_SESSION, TRUE) . '</pre>';

这篇关于如何打印当前设置的所有会话变量?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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