Notice: Undefined variable: _SESSION,该如何解决
Jun 13, 2016 am 10:20 AM
quot
session
time
undefined
variable
Notice: Undefined variable: _SESSION
- PHP code
<!--Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/-->echo $_SESSION['time']."<br>";
Copy after login
这句话报错。
Notice: Undefined variable: _SESSION
但是加上赋值就不报错。并且可以显示出aa。
- PHP code
<!--Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/-->$_SESSION['time'] = 'aa';echo $_SESSION['time']."<br>";
Copy after login
不知什么原因。
------解决方案--------------------
$_SESSION是在调用session_start()后才被定义的。在这之前,它不是超级全局变量。
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

Hot Article
How Long Does It Take To Beat Split Fiction?
3 weeks ago
By DDD
Repo: How To Revive Teammates
3 weeks ago
By 尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island Adventure: How To Get Giant Seeds
3 weeks ago
By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
1 weeks ago
By 尊渡假赌尊渡假赌尊渡假赌

Hot tools Tags

Hot Article
How Long Does It Take To Beat Split Fiction?
3 weeks ago
By DDD
Repo: How To Revive Teammates
3 weeks ago
By 尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island Adventure: How To Get Giant Seeds
3 weeks ago
By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
1 weeks ago
By 尊渡假赌尊渡假赌尊渡假赌

Hot Article Tags

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

How to set session timeout in SpringBoot Session

Solution to PHP Session cross-domain problem

TypeError: Cannot read property '$XXX' of undefined in Vue, how to deal with it?

Monotonic clock processing of time package

Solution to PHP Notice: Undefined property:

How to correctly read and write Session data in multiple files with PHP

How to implement SMS login in Redis shared session application
