Home >Backend Development >PHP Problem >PHP determines whether session is empty
php determines whether the session is empty:
if (isset($_SESSION['aa'])) { echo '有值'; } else { echo '没有值'; }
isset - detects whether the variable has been set and is not NULL
if it has been released using unset() After a variable, it will no longer be isset(). If isset() is used to test a variable that is set to NULL, FALSE will be returned. Also note that the null character ("\0") is not equivalent to PHP's NULL constant.
PHP session variables are used to store information about the user session (session), or to change the settings of the user session (session). Session variables store information for a single user and are available to all pages in the application.
The working mechanism of Session is to create a unique id (UID) for each visitor and store variables based on this UID. The UID is stored in a cookie or passed through the URL.
Recommendation: php server
Related topic recommendation: php session (including pictures, texts, videos, Case)
The above is the detailed content of PHP determines whether session is empty. For more information, please follow other related articles on the PHP Chinese website!