doudong7256 2013-02-20 06:06
浏览 46
已采纳

php标头重定向无法正常工作

So, I consolidated various php login files from here into one file. to consolidate it to one file, I append the url, and do different things based off of what is appended.

This works locally but not on my remote server.

Anyway...

At the top of my 'consolidated' file I have

session_start();

This is the only time I have a session_start(). The rest of my post.php code looks like this:

if(isset($_GET['app1'])){
...do stuff
header("location:post.php?app2");
    exit();
}
if(isset($_GET['app2'])){
...do other stuff
header("location:post.php?app3");
    exit();
}

Locally, if I start at post.php?app1, it will go to post.php?app2 and work fine, but on the remote server it just gets stuck (no redirect). Does anyone know why?

  • 写回答

1条回答 默认 最新

  • duanhegn231318 2013-02-20 06:19
    关注

    maybe these happen because there was a code that provide an output before trying to redirect. try add buffer function in your 'consolidated'file.

    ob_start();
    session_start();
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 工创大赛太阳能电动车项目零基础要学什么
  • ¥20 limma多组间分析最终p值只有一个
  • ¥15 nopCommerce开发问题
  • ¥15 torch.multiprocessing.spawn.ProcessExitedException: process 1 terminated with signal SIGKILL
  • ¥15 QuartusⅡ15.0编译项目后,output_files中的.jdi、.sld、.sof不更新怎么解决
  • ¥15 pycharm输出和导师的一样,但是标红
  • ¥15 想问问富文本拿到的html怎么转成docx的
  • ¥15 我看了您的文章,遇到了个问题。
  • ¥15 GitHubssh虚拟机连接不上
  • ¥15 装完kali之后下载Google输入法 重启电脑后出现以下状况 且退不出去 桌面消失 反复重启没用