codeigniter 我收到已发送的标头

发布于 2024-10-11 21:59:27 字数 498 浏览 4 评论 0原文

我收到这个错误

遇到 PHP 错误

严重性:警告

消息:无法修改标头 信息 - 已发送的标头 (输出开始于 /home/rapcomdk/public_html/system/language/danish/imglib_lang.php:1) 文件名:helpers/url_helper.php 行 数量:541

我不知道问题出

在我的控制器上:

http://pastebin.com/EMtcMgsB

和这是我的模型文件:

http://pastebin.com/iH6xQFGA

希望有人可以帮助我

i got this error

A PHP Error was encountered

Severity: Warning

Message: Cannot modify header
information - headers already sent by
(output started at
/home/rapcomdk/public_html/system/language/danish/imglib_lang.php:1)
Filename: helpers/url_helper.php Line
Number: 541

i dont know what the problem is

here is my controller:

http://pastebin.com/EMtcMgsB

and here is my model file:

http://pastebin.com/iH6xQFGA

hope some one can help me out

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

骄傲 2024-10-18 21:59:27

检查并确保在 system/language/danish/imglib_lang.php 中,标记之前没有空格,并确保没有结束 < code>?> 文件中的 php 标记。

Check and make sure in system/language/danish/imglib_lang.php that you have no whitespace before the <?php tag and make sure you do not have a closing ?> php tag in the file.

九公里浅绿 2024-10-18 21:59:27

除了 jondavidjohn 的回答之外,如果您使用的是 Unicode文件编码,请确保文件开头不存在字节顺序标记。在某些平台上,这可能会对 PHP 处理造成严重破坏。

In addition to jondavidjohn's answer, if you're using Unicode encoding for the files, make sure there's not a byte order mark starting off the file. On some platforms, this can wreak havoc on PHP processing.

又爬满兰若 2024-10-18 21:59:27

确保 codeigniter 中没有错误,有时错误可能会被其他错误覆盖,例如一个错误导致另一个错误。

Make sure there are no errors in codeigniter, sometimes the errors can be covered by other errors, such as one error lead to another.

雪若未夕 2024-10-18 21:59:27

问题出在 system/language/danish/imglib_lang.php 中,在服务器上解析时,它的 部分之前必须有一些字符。发生的情况是 helpers\url_helper.php 尝试重定向(使用此代码;)

case 'refresh'  : header("Refresh:0;url=".$uri);

但失败,因为 imglib_lang.php, line 1 已经发送了一些非标头回复文本。由于标题排在第一位,因此它会向您发出警告。

我想知道它在本地工作但不在部署服务器上工作。可能是文件传输不干净,或者服务器使用不同版本的 PHP,对字符集的处理方式不同。

多次检查;

  1. 绝对确定 system/language/danish/imglib_lang.php 前面没有 BOM。 让我们知道您为何如此确定。例如,如果您在 Windows 上的记事本中编辑了该文件,它将获得字节顺序标记。由于某些工具会“吞掉”该标记,因此很难判断。还要确保没有纯空白。
  2. 保存 imglib_lang.php 时,请确保以 ASCII 格式保存。
  3. 比较 PHP 的本地版本和远程版本。如果存在差异,请将本地副本更新为与服务器相同,然后重新测试。
  4. 检查文件是否正在完美传输。如果您使用 FTP 上传文件,那么 FTP 可能会在传输文件时对其进行修改。 FTP 有两种模式 - ASCII 模式和 BINARY 模式。如果文件以 ASCII 格式传输,则可能会对文件进行一些重写。尝试确保 imglib_lang.php 以二进制形式传输,以确保上传的文件准确无误。

The problem is in system/language/danish/imglib_lang.php, which must have some character before the <?php part by the time it is parsed on the server. What's happening is that helpers\url_helper.php is trying to redirect (using this code;)

case 'refresh'  : header("Refresh:0;url=".$uri);

But is failing because imglib_lang.php, line 1 has already sent some non-header text to the response. Since headers come first, it's giving you the warning.

I wonder at it working locally but not on the deployment server. It may be that the file is not being transferred cleanly, or that the servers use different versions of PHP with different handlings of character sets.

Several checks;

  1. Be absolutely sure there is no BOM at the front of system/language/danish/imglib_lang.php. Let us know why you are certain. If you've edited the file in Notepad on windows, for instance, it'll have gained the Byte Order Mark. It can be very hard to tell since some tools 'swallow' the mark. Also make sure there's no plain whitespace.
  2. When you save imglib_lang.php, make sure you save it in ASCII.
  3. Compare local and remote versions of PHP. If there are differences, update your local copy to the same as the servers, and retest.
  4. Check that the file is being transferred perfectly. If you are putting the file up using FTP, then FTP may be modifying it as it transfers it. FTP has two modes - an ASCII mode and a BINARY mode. If the files are being transferred as ASCII, then there may be some rewriting of the file going on. Try making sure imglib_lang.php is being transferred as BINARY to make sure the exact file is being uploaded.
眼眸印温柔 2024-10-18 21:59:27

如果您认为所有配置都正确,则可能您的库(或者具体来说,imglib_lang.php)只是生成 PHP 警告或通知。如果您可以从主机那里获取日志,那将会很有帮助。

否则,您可以尝试关闭 PHP 的错误报告:(

error_reporting(0);

您可以将该行放在您的index.php中)

If you think that you have everything configured correctly, maybe your library (or specifically, imglib_lang.php) is simply producing PHP warnings or notices. If you can get a hold of your logs from your host, it would be helpful.

Otherwise, you can try to turn off PHP's error reporting:

error_reporting(0);

(you can place that line in your index.php)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文