If you want to know weather the session is already begin or not in PHP then, you can use of the syntax from PHP manual
see the example below
if (!isset($_SESSION)) session_start();
2.
And in case you are using PHP < 5.4 you have to the code below:
if (version&_compare(phpversion(), '5.4.0', '<')) {
if(session&_id() == '') {
session&_start();
}
}
else
{
if (session&_status() == PHP&_SESSION&_NONE) {
session&_start();
}
}
In the code above the benefit is your code will works fine whatever is you php version
0 Comment(s)