Home >Backend Development >PHP Tutorial >Methods to create and destroy sessions in PHP7

Methods to create and destroy sessions in PHP7

angryTom
angryTomOriginal
2020-02-02 21:30:353585browse

session can store variables in the user session, used to change the user's session settings, and can be used on all pages in the application. Below we will introduce the methods of creating and destroying sessions in PHP7. I hope it will be helpful to you!

Methods to create and destroy sessions in PHP7

Methods to create and destroy sessions in PHP7

session can save any data type

1, start session session

session_start()

2, set session

$_SESSION['USENAME']="96net.com.cn";

3, destroy session

unset($_SESSION['views']);
session_destroy();

About the location where the session is saved on the server, it can be replaced by a database, which can be used by multiple servers at the same time

session_save_path

Recommended related article tutorials: php tutorial

php Chinese website learning topic: php session (including pictures, texts, videos, cases)

The above is the detailed content of Methods to create and destroy sessions in PHP7. For more information, please follow other related articles on the PHP Chinese website!

Statement:
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