解决Undefined variable: _SESSION的方法

Notice: Undefined variable: _SESSION的原因及解决方法

遇到Undefined variable: _SESSION 错误的原因是php session没有开启引起的。

下面有两种解决办法.

1. 在程序里添加session_start()函数

2.在php.ini里将session.auto_start = 0设置为session.auto_start = 1

以上就是解决Undefined variable: _SESSION的方法。

出处:http://www.phpbest.com/html/content-9-377-1.html


Notice: A session had already been starte解决办法

Notice: A session had already been started – ignoring session_start() in .. on line ..
This happens when you try to start session more than once.

The solution for above problem is

1) in php.ini file set session.autostart to 0

session.auto_start = 0

2) In your code use this line

if (!session_id()) session_start();

instead of

session_start();


你可能感兴趣的:(解决Undefined variable: _SESSION的方法)