duanlei1957 2014-02-25 15:19
浏览 41

PHP - 警告:无法修改标题信息 - 仍然卡住[重复]

This question already has an answer here:

I know this has been asked a million times, but I've gone through all the answers to no avail, and as I only have a small amount of code, I figured it's a relatively simple fix (I hope). The frustrating thing is, is that php file works perfectly on one server, but not on another.

I'm receiving this error:

Warning: Cannot modify header information - headers already sent by (output started at /home/thepcguy/public_html/ship_image/functions/function-redirect.php:1) in /home/thepcguy/public_html/ship_image/functions/function-redirect.php on line 9

relating to this file

<?php require_once('../Connections/ships.php');

if ($_GET['shore'] == "1") {
   header('Location: ../shore_establishment.php?ship_id=' .urlencode($_GET['ship_id']) . "&shore=1" . "&page=ship");
   //echo"first";
} else if ($_GET['shore'] == "0") {
  header('Location: ../shipinfo.php?ship_id=' .urlencode($_GET['ship_id']). "&shore=0" . "&page=ship");
   //echo"second";
};

?>

For interests sake, the file ships.php is:

<?php
$hostname_ships = "xxxxx";
$database_ships = "xxxxx";
$username_ships = "xxxxx";
$password_ships = "xxxxx";
$ships = mysql_pconnect($hostname_ships, $username_ships, $password_ships); 
?>
</div>
  • 写回答

3条回答 默认 最新

  • douzhi1972 2014-02-25 15:25
    关注

    Most likely you get notification that mysql_* is deprecated, and that is actually outputted to your browser, therefore you can't send headers since output is already sent...

    Probably one server doesn't send notification, and other do, that's why it works on one, and not on other. To test set this as first line in you file:

    error_reporting(E_ALL ^ E_DEPRECATED);

    评论

报告相同问题?

悬赏问题

  • ¥15 使用C#,asp.net读取Excel文件并保存到Oracle数据库
  • ¥15 C# datagridview 单元格显示进度及值
  • ¥15 thinkphp6配合social login单点登录问题
  • ¥15 HFSS 中的 H 场图与 MATLAB 中绘制的 B1 场 部分对应不上
  • ¥15 如何在scanpy上做差异基因和通路富集?
  • ¥20 关于#硬件工程#的问题,请各位专家解答!
  • ¥15 关于#matlab#的问题:期望的系统闭环传递函数为G(s)=wn^2/s^2+2¢wn+wn^2阻尼系数¢=0.707,使系统具有较小的超调量
  • ¥15 FLUENT如何实现在堆积颗粒的上表面加载高斯热源
  • ¥30 截图中的mathematics程序转换成matlab
  • ¥15 动力学代码报错,维度不匹配