note 92620 modified in function.header by tularis

From: Date: Fri, 04 Apr 2014 11:18:20 +0000
Subject: note 92620 modified in function.header by tularis
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-199127@lists.php.net to get a copy of this message
I just want to add, becuase I see here lots of wrong formated headers. 1. All used headers have first letters uppercase, so you MUST follow this. For example: Location, not location Content-Type, not content-type, nor CONTENT-TYPE 2. Then there MUST be colon and space, like good: header("Content-Type: text/plain"); wrong: header("Content-Type:text/plain"); 3. Location header MUST be absolute uri with scheme, domain, port, path, etc. good: header("Location: http://www.example.com/something.php?a=1"); 4. Relative URIs are NOT allowed wrong: Location: /something.php?a=1 wrong: Location: ?a=1 It will make proxy server and http clients happier. --was-- I just want to add, becuase I see here lots of wrong formated headers. 1. All used headers have first letters uppercase, so you MUST follow this. For example: Location, not location Content-Type, not content-type or CONTENT-TYPE 2. Then there MUST be colon and space, like good: header("Content-Type: text/plain"); wrong: header("Content-Type:text/plain"); 3. Location header MUST be absolute uri with scheme, port and so on. good: header("Location: http://www.example.com/something.php?a=1"); 4. It cann't be relative: wrong: Location: /something.php?a=1 wrong: Location: ?a=1 It will make proxy server and http clients happier. http://php.net/manual/en/function.header.php

« previous php.notes (#199127) next »