国产av日韩一区二区三区精品,成人性爱视频在线观看,国产,欧美,日韩,一区,www.成色av久久成人,2222eeee成人天堂

Implementation of user logout function

Add the following code in application/index/view/login/members.html:

<form action="/public/index.php/index/login/logout" method="post">
   <p><input style="border: #008800" type="submit" value="注銷"></p>
</form>

Add the method logout() in application/index/controller/Login.php

Code:

<?php
public function logout(){
    session_start();
    Db::table('think_user')->where('user_name', $_SESSION['admin_name'])->update(['status' => 0]);
    session_unset($_SESSION['admin_name']);
    session_destroy();//銷毀一個(gè)會(huì)話中的全部數(shù)據(jù)
    return $this->error('注銷成功','index');
}

Logout requires deleting the session and modifying the database status information

The running results are as follows Shown:
gif5新文件 (14).gif

Continuing Learning
||
<?php echo "注銷功能";
submitReset Code