note 114833 added to yaf-response-abstract.setheader

From: Date: Fri, 11 Apr 2014 14:45:52 +0000
Subject: note 114833 added to yaf-response-abstract.setheader
Groups: php.notes 
Request: Send a blank email to php-notes+get-199248@lists.php.net to get a copy of this message
A few examples of how to send headers from a controller... /* Set Content-Type */ $response = $this -> getResponse(); $response -> setHeader( 'Content-Type', 'text/html; charset=utf-8' ); $response -> response(); /* Set HTTP Status */ $response = $this -> getResponse(); $response -> setHeader( $this -> getRequest() -> getServer( 'SERVER_PROTOCOL' ), '404 Not Found' ); $response -> response(); You could also use $_SERVER[ 'SERVER_PROTOCOL' ] however it is recommend to extend the request class do some cleaning of the super globals then you should be good to go. ---- Server IP: 72.52.91.14 Probable Submitter: 80.47.53.86 ---- Manual Page -- http://php.net/manual/en/yaf-response-abstract.setheader.php Edit -- https://master.php.net/note/edit/114833 Del: integrated -- https://master.php.net/note/delete/114833/integrated Del: useless -- https://master.php.net/note/delete/114833/useless Del: bad code -- https://master.php.net/note/delete/114833/bad+code Del: spam -- https://master.php.net/note/delete/114833/spam Del: non-english -- https://master.php.net/note/delete/114833/non-english Del: in docs -- https://master.php.net/note/delete/114833/in+docs Del: other reasons-- https://master.php.net/note/delete/114833 Reject -- https://master.php.net/note/reject/114833 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#199248) next »