Home  >  Article  >  Backend Development  >  Beginner: How to use Session in PHP development? _PHP Tutorial

Beginner: How to use Session in PHP development? _PHP Tutorial

WBOY
WBOYOriginal
2016-07-13 17:30:03892browse

How to use Session?


//Must be added before use;
session_start();
?>
//Consider we have When considering whether to write session
if (isset($_POST[userid])){
//If you really agree to write:
$_SESSION[userid] = $ccdot

}else{
//or return cannot be written to session
}
?>


When you want to clear:

session_start();
unset($_SESSION[userid]); //OR : session_register(username);

The main function of the session_unregister() function is to unregister the current A session variable. But please note that if you use $HTTP_SESSION_VARS or $_SESSION on the current page

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/509208.htmlTechArticleHow to use Session? ?php //Must be added before use; session_start(); ? ?php // Consider that we sometimes consider whether to write session if(isset($_POST[userid])){ //If we really agree to write...
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