Home  >  Article  >  Backend Development  >  $_SESSION为什么不让打

$_SESSION为什么不让打

WBOY
WBOYOriginal
2016-06-23 14:39:13884browse

我想打印出$_SEEION这个数组中的结构,但是返回的却是Notice:  Undefined variable: _SESSION in D:\wamp\www\test.php on line 3  记得以前打印$_SERVER很容易就出来,不知这个是为什么

<?php    echo '<pre class="brush:php;toolbar:false">';    print_r($_SESSION);    echo '
';?>


回复讨论(解决方案)

由于变量未定义引起的

请先session_start()

session 未开启

<?php    session_start();    echo '<pre class="brush:php;toolbar:false">';    print_r($_SESSION);    echo '
';?>

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
Previous article:敏感词汇过滤Next article:求助!!php+ajax+ json 问题