简体   繁体   中英

CakePHP cannot modify header?

I am using CakePHP 1.3 and it keeps telling me the following.

Cannot modify header information

This ONLY happens when I include the Auth component.

  var $components = array('Auth');

Am I doing something wrong, a bug, or what?

Cannot modify header information signifies that your script (in this case, the auth component) is attempting to manipulate HTTP headers after they've been sent to the client. You can counteract this behaviour by enabling output buffering with the ob_start() function.

Headers have to be the first part of a web page that you send. Make sure that you haven't outputted any other information before you try sending any kind of header.

This may also be useful

It is either what FRKT mentions above, or the code is always trying to modify the headers and the included component is writing something to the output before cake has a chance to write the headers out. An example of a great cause is having extra whitespace after the %> at the end of the file. (I recommend not included the close PHP tag at the end of the files for this reason).

Jacob

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM