Support Joomla!

references:joomla.framework:filesystem:jfile-read

Table of Contents

read

API Package Subpackage Class Method Reference Last reviewed Doc status
API Home Package Joomla.Framework Subpackage FileSystem Class JFile Method read Reference read() Never Work in Progress

Reads the contents of a file. If the current user has permission and safe mode is turned off, or the protocol is HTTP (i.e. the file name starts with http://) then this function will use the PHP fopen function. Otherwise, the function will use ftp (if enabled) to read the file. The function returns a string containing the contents of the file if successful. Otherwise, the function returns false and may raise a warning using the JError class.

Syntax

string read ( $filename, $incpath )

$filename string is a string containing the full file path.
$incpath boolean is a flag that specifies whether or not to use the include path (only applicable if the file can be opened using the PHP fopen function).

Examples

Example: This example reads the robot.txt file.

Example

echo JFile::read( 'robots.txt' );

which might produce something like:

Result

User-agent: * 
Disallow: /administrator/
Disallow: /cache/
Disallow: /components/
Disallow: /editor/
Disallow: /help/
Disallow: /images/
Disallow: /includes/
Disallow: /language/
Disallow: /mambots/
Disallow: /media/
Disallow: /modules/
Disallow: /templates/
Disallow: /installation/

Discussion

Full name:
E-Mail:
 
references/joomla.framework/filesystem/jfile-read.txt (785 views) · Last modified: 2007/08/15 15:05