【发布时间】:2012-10-10 11:04:19
【问题描述】:
我正在使用以下 PHP 代码来检查会话。但如果会话未登录,则页面不会重定向,只显示黑页。
我的如果条件是对的!它正在命中标题功能.. 这是我的代码:
if(
!isset($_SESSION['SESS_MEMBER_ID'])
|| (trim($_SESSION['SESS_MEMBER_ID']) == '')
AND !isset($fb_login)
) {
header("location:login.php?msg=Please+Login+Again.");
}
欢迎提出建议!
HTTP/1.1 200 OK
Date: Wed, 10 Oct 2012 10:57:14 GMT
Server: Apache/2.2.15 (CentOS)
X-Powered-By: PHP/5.3.3
Connection: close
Transfer-Encoding: chunked
Content-Type: text/html; charset=UTF-8
【问题讨论】:
-
您可能会觉得这很有帮助:will PHP header() & exit() securely terminate a script before redirecting? 但您的问题包含的信息太少,无法真正说出您遇到的具体问题。
-
开启错误报告。如果您没有收到“标头已发送”错误,我会非常感到惊讶。
-
错误报告已开启!没有错误...如果条件是完美的。它正在命中标题功能
-
好吧,如果你做的一切都是正确的并且语法完美,为什么还要用这个问题来打扰我们呢?
标签: php redirect http-headers