导致错误的PHP位置标题 [英] PHP Location Header Causing an Error

查看:106
本文介绍了导致错误的PHP位置标题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

  header('Location:/ members')

;

它总是用来工作。但现在,当我尝试加载页面时,Chrome给了我这个错误:

  HTTP错误500(内部服务器错误) :服务器试图完成请求时遇到意外情况。 

在Firefox上,我只是得到一个空白页面。当我将注释语句注释掉时,它可以正常工作,但没有重定向(显然)。

我试着用输出缓冲打开和关闭,效果相同。任何想法?编辑:我有一个PHP头部语句在代码的开头,用户重定向到成员页面,如果他们已经登录。这可能会影响它?我只是把error_reporting(E_ALL)和ini_set(display_errors)放在一起, ,1),你会看到什么是错的。


I have the following tag for when a user is successfully logged in:

header('Location: /members');

It always used to work. Now, however, when I try to load the page, Chrome gives me this error:

HTTP Error 500 (Internal Server Error): An unexpected condition was encountered while the server was attempting to fulfill the request.

On Firefox, I just get a blank page. When I comment the header statement out, it works, but without the redirect (obviously).

I have tried it with output buffering on and off, with the same effect. Any ideas?

Edit: I have a PHP header statement at the beginning of the code that redirects users to the member page if they are already logged in. Could this be affecting it? I'm not getting any headers already sent errors...

解决方案

Just put error_reporting(E_ALL) and ini_set("display_errors", 1) and you'll see what's wrong.

这篇关于导致错误的PHP位置标题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆