diff options
author | Andrey Andreev <narf@bofh.bg> | 2012-11-29 16:21:43 +0100 |
---|---|---|
committer | Andrey Andreev <narf@bofh.bg> | 2012-11-29 16:21:43 +0100 |
commit | cc4b00347c9ff061488bc88194002be701f4190f (patch) | |
tree | 899984be1b01268cff965aa30d31e5f56a8701a3 /user_guide_src/source/libraries | |
parent | e1d6c46b7d5e3d82dc6953af29f0b02ccb03e2dc (diff) |
Added CI_Output::get_header()
(an improved version of PR #645)
Also fixed get_content_type() to only return the MIME value and created
Output library unit tests for both of these methods.
Diffstat (limited to 'user_guide_src/source/libraries')
-rw-r--r-- | user_guide_src/source/libraries/output.rst | 30 |
1 files changed, 25 insertions, 5 deletions
diff --git a/user_guide_src/source/libraries/output.rst b/user_guide_src/source/libraries/output.rst index 82b1a56a5..a3d67b847 100644 --- a/user_guide_src/source/libraries/output.rst +++ b/user_guide_src/source/libraries/output.rst @@ -53,17 +53,37 @@ You can also set the character set of the document, by passing a second argument $this->output->set_content_type('css', 'utf-8'); -$this->output->get_content_type(); -========================================== +$this->output->get_content_type() +================================= -Returns the Content-Type HTTP header that's currently in use. +Returns the Content-Type HTTP header that's currently in use, +excluding the character set value. $mime = $this->output->get_content_type(); .. note:: If not set, the default return value is 'text/html'. -$this->output->get_output(); -============================= +$this->output->get_header() +=========================== + +Gets the requested HTTP header value, if set. + +If the header is not set, NULL will be returned. +If an empty value is passed to the method, it will return FALSE. + +Example:: + + $this->output->set_content_type('text/plain', 'UTF-8'); + echo $this->output->get_header('content-type'); + // Outputs: text/plain; charset=utf-8 + +.. note:: The header name is compared in a case-insensitive manner. + +.. note:: Raw headers sent via PHP's native ``header()`` function are + also detected. + +$this->output->get_output() +=========================== Permits you to manually retrieve any output that has been sent for storage in the output class. Usage example:: |