我不确定这是怎么回事,但是如果使用以下代码,我的登录按钮将不会显示:
但是如果我删除了isset,它确实可以工作...我猜我不需要为登录页面使用isset,因为它没有发送任何信息吗?
我尝试使用相同的代码,但没有isset函数,它可以工作,但是大多数视频都在使用isset函数
<?php
include_once 'navbar.php';
session_start();
if(isset($_SESSION{'u_uid'})) {
echo '<div class="login_form">
<div class="login_form_welcome">
<h2>Welcome to the Login Form</h2>
</div>
<form action="medical_login_process.php" method="POST">
<input type="text" name="username" placeholder="username/email">
<br />
<br />
<input type="password" name="password" placeholder="password">
<br />
<br />
<button type="submit" name="submit">Login</button>
</div>';
} else {
echo ' <div class="logout">
<form action="medical_logout_process.php" method="POST">
<button type="submit" name="logout">Logout</button>
</div>';
}
答案 0 :(得分:0)
将if(isset($_SESSION{'u_uid'})) {
更改为if(isset($_SESSION['u_uid'])) {
。
请注意使用方括号而不是大括号。
请注意:由于这是一种错字,除了您以外,对其他人并没有真正的用处,因此我决定将其关闭。