Home > Article > Backend Development > How to implement non-login jump in php
php method to implement non-login jump: first open the corresponding PHP file; then determine whether the session exists; finally use the "if (!$_SESSION['xxx']){}" method to determine the jump to Just go to the login page.
The operating environment of this article: windows7 system, PHP7.1 version, DELL G3 computer
php implementation: go to the login page when not logged in
Determine whether the session exists. If it does not exist, jump to the login page
session_start(); if ( !$_SESSION['xxx'] ) { header("Location: login.php"); exit; }
Record the session after logging in
Destroy the session after logging out
[Recommended learning : "PHP Video Tutorial"]
The above is the detailed content of How to implement non-login jump in php. For more information, please follow other related articles on the PHP Chinese website!