亚洲国产日韩欧美一区二区三区,精品亚洲国产成人av在线,国产99视频精品免视看7,99国产精品久久久久久久成人热,欧美日韩亚洲国产综合乱

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