API15:JResponse/toString
From Joomla! Documentation
This Namespace has been archived - Please Do Not Edit or Create Pages in this namespace. Pages contain information for a Joomla! version which is no longer supported. It exists only as a historical reference, will not be improved and its content may be incomplete.
Contents |
Description
Sends all headers prior to returning the string
Description:JResponse/toString
Syntax
toString($compress=false)
| Parameter Name | Default Value | Description |
|---|---|---|
| $compress | false | $compress If true, compress the data |
Returns
string
Defined in
libraries/joomla/environment/response.php
Importing
jimport( 'joomla.environment.response' );
Source Body
function toString($compress = false) { $data = JResponse::getBody(); // Don't compress something if the server is going todo it anyway. Waste of time. if($compress && !ini_get('zlib.output_compression') && ini_get('output_handler')!='ob_gzhandler') { $data = JResponse::_compress($data); } if (JResponse::allowCache() === false) { JResponse::setHeader( 'Expires', 'Mon, 1 Jan 2001 00:00:00 GMT', true ); // Expires in the past JResponse::setHeader( 'Last-Modified', gmdate("D, d M Y H:i:s") . ' GMT', true ); // Always modified JResponse::setHeader( 'Cache-Control', 'no-store, no-cache, must-revalidate, post-check=0, pre-check=0', false ); JResponse::setHeader( 'Pragma', 'no-cache' ); // HTTP 1.0 } JResponse::sendHeaders(); return $data; }
[Edit See Also] SeeAlso:JResponse/toString
Examples
<CodeExamplesForm />
