Home > php教程 > php手册 > 《php和MySQL Web开发》第23章在php中使用对话控制,遇到难题卡

《php和MySQL Web开发》第23章在php中使用对话控制,遇到难题卡

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-06-06 19:41:33
Original
954 people have browsed it

《php和MySQL Web开发》第23章在php中使用会话控制,遇到难题卡壳了~ ?php session_start(); $_SESSIO【本文来自鸿网互联 (http://www.68idc.cn)】N_['sess_var']="HelloWorld"; echo$_SESSION['sess_var']; echo'Thecontentof$_SESSION[\'sess_var\']is'.$_

《php和MySQL Web开发》第23章在php中使用会话控制,遇到难题卡壳了~
<?php<br />
	session_start();<br />
	<br />
	$_SESSIO【本文来自鸿网互联 (http://www.68idc.cn)】N_[ 'sess_var'] = "Hello World";<br />
	echo $_SESSION[ 'sess_var'];<br />
<br />
	echo 'The content of $_SESSION[\'sess_var\'] is '.$_SESSION[ 'sess_var'].'<br />';<br />
	<br />
?>
Copy after login

运行结果:
The content of $_SESSION['sess_var'] is 
为什么$_SESSION_[ 'sess_var']没有打印出来,是session已经失效了么?
------解决思路----------------------
你是
这样赋值 $_SESSION_[ 'sess_var'] = "Hello World";
这样使用 echo $_SESSION[ 'sess_var'];


难道你认为 $_SESSION_ 和 $_SESSION 是一个东西吗?

应让 php 检查全部错误(令 php.ini 中 error_reporting = E_ALL),这样 php 就会告诉你哪些地方有问题了
------解决思路----------------------
session_start();
$_SESSION_[ 'sess_var'] = "Hello World";
var_dump($_SESSION);
Related labels:
source:php.cn
Statement of this Website
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
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template