Jump to content
Larry Ullman's Book Forums

Newlines After Multiple Headers Mistake


Recommended Posts

On page 323 of the book, it says "if a script uses multiple header() calls, each should be terminated by a newline."

 

However, I've seen elsewhere in the book and in the PHP Advanced, code using multiple headers without being terminated by a newline. I've also tried searching on the Internet for this rule, but couldn't find anything.

 

Is this a mistake? Probably referring to email headers?

Link to comment
Share on other sites

If your unsure about whether there is an error check the books errata

 

Have you looked into the php manual regarding headers? It may not give you your definitive answer in black and white, but you might be able to come to the answer by reading between the lines.

 

Also try mail() you may find the answer your looking for under additional headers

 

;)

Link to comment
Share on other sites

The books errata mentions nothing about it.

 

The PHP site mentions nothing about it, and I see the user notes' code on there using both newlines and without newlines.

 

I know mail requires newlines for multiple headers, but that has nothing to do with this type of header call. I was just merely pointing out a possible confusion Mr. Ullman may have made.

 

I still don't have an answer. Mr. Ullman are you there?

 

Thanks.

Link to comment
Share on other sites

"The header fields are transmitted after the request or response line, the first line of a message. Header fields are colon-separated name-value pairs in clear-text string format, terminated by a carriage return (CR) and line feed (LF) character sequence. The end of the header fields is indicated by an empty field, resulting in the transmission of two consecutive CR-LF pairs"

Wikipedia

Link to comment
Share on other sites

 Share

×
×
  • Create New...