From cc4b00347c9ff061488bc88194002be701f4190f Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Thu, 29 Nov 2012 17:21:43 +0200 Subject: 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. --- user_guide_src/source/libraries/output.rst | 30 +++++++++++++++++++++++++----- 1 file changed, 25 insertions(+), 5 deletions(-) (limited to 'user_guide_src/source/libraries/output.rst') 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:: -- cgit v1.2.3-24-g4f1b