codeigniter 我收到已发送的标头
我收到这个错误
遇到 PHP 错误
严重性:警告
消息:无法修改标头 信息 - 已发送的标头 (输出开始于 /home/rapcomdk/public_html/system/language/danish/imglib_lang.php:1) 文件名:helpers/url_helper.php 行 数量:541
我不知道问题出
在我的控制器上:
和这是我的模型文件:
希望有人可以帮助我
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:
and here is my model file:
hope some one can help me out
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
检查并确保在
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.除了 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.
确保 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.
问题出在
system/language/danish/imglib_lang.php
中,在服务器上解析时,它的部分之前必须有一些字符。发生的情况是
helpers\url_helper.php
尝试重定向(使用此代码;)但失败,因为
imglib_lang.php, line 1
已经发送了一些非标头回复文本。由于标题排在第一位,因此它会向您发出警告。我想知道它在本地工作但不在部署服务器上工作。可能是文件传输不干净,或者服务器使用不同版本的 PHP,对字符集的处理方式不同。
多次检查;
system/language/danish/imglib_lang.php 前面没有 BOM。
让我们知道您为何如此确定。例如,如果您在 Windows 上的记事本中编辑了该文件,它将获得字节顺序标记。由于某些工具会“吞掉”该标记,因此很难判断。还要确保没有纯空白。imglib_lang.php
时,请确保以 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 thathelpers\url_helper.php
is trying to redirect (using this code;)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;
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.imglib_lang.php
, make sure you save it in ASCII.imglib_lang.php
is being transferred as BINARY to make sure the exact file is being uploaded.如果您认为所有配置都正确,则可能您的库(或者具体来说,
imglib_lang.php
)只是生成 PHP 警告或通知。如果您可以从主机那里获取日志,那将会很有帮助。否则,您可以尝试关闭 PHP 的错误报告:(
您可以将该行放在您的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:
(you can place that line in your index.php)