PHP Sessions
Test-for and start a session
- The
$_SESSION
variable cannot be accessed without first starting a session. - PHP will throw a warning if a session exists and you call
session_start()
.
if (!session_id()) {
session_start();
}
Test-for and start a session
$_SESSION
variable cannot be accessed without first starting a session.session_start()
.if (!session_id()) {
session_start();
}