PHP之会话session

通过全局变量来判定是否设置session相关值

<?php
session_start();if (! isset($_SESSION['username'])) {if (isset($_POST['username'])) {$name = $_POST['username'];if ($name == '123') {$_SESSION['username'] = $_POST['username'];echo "Welcome!<br/>";} else {require_once 'login.html';}} else {require_once 'login.html';}
} else {echo "you have logged!<br/>";session_unset();
}

 

本文链接:https://my.lmcjl.com/post/7546.html

展开阅读全文

4 评论

留下您的评论.