本文实例讲述了php使用session二维数组的用法。分享给大家供大家参考。具体如下:
最普通的用法:一个变量名
$_SESSION['user'] = 0;
echo $_SESSION['user'];
使用数组:
$_SESSION['user']['a'] = 1;
$_SESSION['user']['b'] = 2;
echo $_SESSION['user']['a'];
echo $_SESSION['user']['b'];
这样的好处是可以分组。
如可以使用:
$_SESSION['admin']['a'] = 11;
$_SESSION['admin']['b'] = 22;
希望本文所述对大家的PHP程序设计有所帮助。
Statement:The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn