Ultimately, I am trying to understand how best to verify that I am working in the same session as my previous request.
After
start_session()
Which of the following values will have changed if my session (a) has not expired or (b) has expired.
session_id()
$_SESSION['session_id']
$_COOKIE['PHPSESSID']
You can use session_status() :
<?php
if (session_status() !== PHP_SESSION_ACTIVE) {
session_start();
}
?>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.