《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 /> ?>
运行结果:
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);

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Atom editor mac version download
The most popular open source editor

SublimeText3 Linux new version
SublimeText3 Linux latest version

mPDF
mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),

Zend Studio 13.0.1
Powerful PHP integrated development environment

SecLists
SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.