I have very big stack of code.
I need to use session_start() function always.
If I hasn't used session_start() not run each other.
example:
<?php
if(session_start() == "used")
{
// not run
}
else
{
session_start();
}
?>
I have very big stack of code.
I need to use session_start() function always.
If I hasn't used session_start() not run each other.
example:
<?php
if(session_start() == "used")
{
// not run
}
else
{
session_start();
}
?>
do you mean, u want to check if the session has already been started? you can get it from here
Check if PHP session has already started
if(session_id() == '') {
// session isn't started
}
if(session_id() === ""){
session_start();
}
I think it will be better to use this top of the page.There is no need to use this sevral time.
session_start();
you can try it this way:
if (!isset($_SESSION)) {
session_start();
}
See also the Session documentation
I think this won't work because you need to do a session_start()
before any line of code