Setting the Status Header
The status header is treated as a "special" header in Fuel. You do not set it as you would other headers. The status header is set as follows in the controller:
$response = new Response($body, 404);
The response class contains the methods to deal with HTTP response and browser output.
The status header is treated as a "special" header in Fuel. You do not set it as you would other headers. The status header is set as follows in the controller:
$response = new Response($body, 404);
The set_header method allows set custom HTTP headers.
This function must called from within a controller method as the response object is one of the controller's properties.
Static | No | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Parameters |
|
||||||||||||
Returns | void | ||||||||||||
Example |
|
The send_headers method sends the set headers out to the browser, including the HTTP status of the request.
This function must called from within a controller method as the response object is one of the controller's properties.
Static | No |
---|---|
Parameters | None |
Returns | void |
Example |
|
Note that you normally don't have to call this method manually. Fuel will take care of this as part of processing the request.
The redirect method offers different methods of redirecting to a new URL.
Static | Yes | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Parameters |
|
||||||||||||
Returns | This method terminates the current script, it does not return. | ||||||||||||
Example |
|