开发者

PHP Show Login if Logged out

开发者 https://www.devze.com 2023-01-30 02:46 出处:网络
Hey, this is a simple question. How can I show a login button if a user 开发者_运维百科is logged out and show a logout button if a user is logged in?

Hey, this is a simple question.

How can I show a login button if a user 开发者_运维百科is logged out and show a logout button if a user is logged in?

Thanks


Assuming $_SESSION['logged-in'] is the session variable that represents the state of being logged in:

if ($_SESSION['logged-in']) {
    echo '<button>log off</button>';
} else {
    echo '<button>log in</button>';
}
0

精彩评论

暂无评论...
验证码 换一张
取 消