I am working on a login script for my website and I can't use header('Location: url');
I'm using a live server for my tests Here's my code
<?php
ob_start();
session_start();
if (isset($_SESSION['username'])) {
header('Location: http://some-website.com/user/');
exit();
}
...
?>
But Instead of redirecting me to the URL given above It just shows the blank page Looks like It's using exit()
but not header()
I'm pretty confused
好吧,看来您的条件没有得到验证,这就是为什么您得到空白页的原因,请尝试通过在if
语句var_dump($_SESSION)
之前添加$_SESSION
全局变量是否包含$_SESSION['username']
,然后检查是否“用户名”在其中。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.