How to know if PHP SESSION variable is expired?

时间:2015-09-01 21:16:15

标签: php session session-variables

I found out that isset($_SESSION['hash']) returns true even if the variable has expired(but does not let me use it). Is there any way to check if it has expired? Thank you!

2 个答案:

答案 0 :(得分:0)

 <?php
 if (session_status() !== PHP_SESSION_ACTIVE) { session_start(); }

答案 1 :(得分:0)

I see what you are getting at now, you will need to keep track of the session time your self using another session the correct answer in this post explains it better than I can: Find out if a session with a particular id has expired