JStream/gets: Difference between revisions
From Joomla! Documentation
New page:
<span class="editsection" style="font-size:76%;">
<nowiki>[</nowiki>Edit Descripton<nowiki>]</nowiki>
</span>
{{Description:JStream/gets}}
===Syntax... |
m clean up |
||
| Line 1: | Line 1: | ||
{{subst:Description:JStream/gets}} | |||
{{Description:JStream/gets}} | |||
===Syntax=== | ===Syntax=== | ||
| Line 64: | Line 59: | ||
</source> | </source> | ||
{{subst:SeeAlso:JStream/gets}} | |||
{{SeeAlso:JStream/gets}} | |||
===Examples=== | ===Examples=== | ||
Revision as of 14:27, 24 March 2017
{{subst:Description:JStream/gets}}
Syntax
gets($length=0)
| Parameter Name | Default Value | Description |
|---|---|---|
| $length | 0 |
Defined in
libraries/joomla/filesystem/stream.php
Importing
jimport( 'joomla.filesystem.stream' );
Source Body
function gets($length=0)
{
if(!$this->_fh)
{
$this->setError(JText::_('File not open'));
return false;
}
$retval = false;
// Capture PHP errors
$php_errormsg = 'Error Unknown';
$track_errors = ini_get('track_errors');
ini_set('track_errors', true);
switch($this->processingmethod)
{
case 'gz':
$res = $length ? gzgets($this->_fh, $length) : gzgets($this->_fh);
break;
case 'bz':
case 'f':
default:
$res = $length ? fgets($this->_fh, $length) : fgets($this->_fh);
break;
}
if(!$res) {
$this->setError($php_errormsg);
} else {
$retval = $res;
}
// restore error tracking to what it was before
ini_set('track_errors',$track_errors);
// return the result
return $retval;
}
{{subst:SeeAlso:JStream/gets}}
Examples
<CodeExamplesForm />