PHP determines whether session is empty

Release: 2023-02-27 21:38:01
Original
5811 people have browsed it

PHP determines whether session is empty

php determines whether the session is empty:

if (isset($_SESSION['aa'])) {
echo '有值';
} else {
echo '没有值';
}
Copy after login

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!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template