开发者

PHP Show Login if Logged out

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜