1 <?php 2 session_start(); 3 4 $_SESSION_[ 'sess_var'] = "Hello World"; 5 echo $_SESSION[ 'sess_var']; 6 7 echo 'The content of $_SESSION[\'sess_var\'] is '.$_SESSION[ 'sess_var'].'<br />'; 8 9 ?>
运行结果:
The content of $_SESSION['sess_var'] is
为什么$_SESSION_[ 'sess_var']没有打印出来,是session已经失效了么?
<?php session_start(); $_SESSION['sess_var'] = "Hello World"; echo $_SESSION['sess_var']; echo 'The content of $_SESSION[\'sess_var\'] is '.$_SESSION['sess_var'].'<br />'; ?>
你看看这段代码和你的代码有啥区别
汗~,看了半天才看出来。谢谢~