Solve undefined variable:_ The method of session

This paper introduces the solution to PHP using session error. For those who use session for the first time, they may encounter undefined variable:_ The reason for an error like session is that the session is not opened. Because session in PHP is not opened by default, it needs to be opened in the program to use. PHP error: PHP notice: undefined variable:_ Reasons and solutions of session

Undefined variable encountered:_ The reason for the session error is that PHP session is not turned on

There are two solutions

1. Add session to the program_ Start() function

2. Add session.auto in php.ini_ Start = 0 is set to session.auto_ start = 1

This is how to solve the problem of undefined variable_ Session

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

N otice:Asessionhadalreadybeenstarte Solutions

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();

Similar Posts: