PHP输出的头部位置重定向前允许量的限制被拒绝 [英] PHP a limit to the amount of output allowed before a Header location redirect is rejected

查看:130
本文介绍了PHP输出的头部位置重定向前允许量的限制被拒绝的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

请问PHP 功能有限制的文本或二进制输出之前拒不重定向浏览器所提供的网址,浏览器的金额?

我注意到,我可以输出到浏览器的然后的做 A重定向头('位置:$网址');出口(); ,但它好像以后我有输出一定数量它拒绝和输出此消息

我从来没有穿过任何东西来了Zend的认证研究中表明这一点,所以我想知道,如果它是一个未公开的特性?


  

警告:不能更改头信息 - 头已经发出
  (输出开始/var/www/vhosts/dev/dev_crmpicco/co.php:935)在
  /var/www/vhosts/dev/dev_crmpicco/includes/Rangers.inc.php线1701



解决方案

答案可以在的头()手动


  

记住header()函数之前,必须调用任何实际产量
  发送,无论是普通的HTML标记,空行的文件,或者从PHP。
  这是一个非常常见的错误读取code。与包括或要求,
  功能或其他文件存取功能,并有空格或空
  是头之前()输出线被调用。同样的问题
  使用单一的PHP / HTML文件时存在。


您不能输出任何文本之前,您设置的头。你可能有某种输出缓冲一套,让您回应任何事情,如果你认为你能够输出一定量的字节头失败之前。

Does the PHP header function have a limit to the amount of textual or binary output to the browser before it refuses to redirect the browser to the provided URL?

I have noticed that I can output to the browser then do a redirect with header('Location: $url'); exit();, but it seems as though after I have output a certain amount it refuses and outputs this message?

I have never came across anything to suggest this during Zend Certification study, so I wondered if it was a undocumented feature?

Warning: Cannot modify header information - headers already sent by (output started at /var/www/vhosts/dev/dev_crmpicco/co.php:935) in /var/www/vhosts/dev/dev_crmpicco/includes/Rangers.inc.php on line 1701

解决方案

The answer can be found in header() manual

Remember that header() must be called before any actual output is sent, either by normal HTML tags, blank lines in a file, or from PHP. It is a very common error to read code with include, or require, functions, or another file access function, and have spaces or empty lines that are output before header() is called. The same problem exists when using a single PHP/HTML file.

You can't output any text before you set the headers. You might have some sort of output buffering set that allows you to echo anything, if you think you are able to output a certain amount of bytes before header fails.

这篇关于PHP输出的头部位置重定向前允许量的限制被拒绝的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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