read_file()

read_file($file)

Parameters:
  • $file (string) – File path
Returns:

File contents or FALSE on failure

Return type:

string

Returns the data contained in the file specified in the path.

Example:

$string = read_file('./path/to/file.php');

The path can be a relative or full server path. Returns FALSE (boolean) on failure.

Note

The path is relative to your main site index.php file, NOT your controller or view files. CodeIgniter uses a front controller so paths are always relative to the main site index.

Note

This function is DEPRECATED. Use the native file_get_contents() instead.

Important

If your server is running an open_basedir restriction this function might not work if you are trying to access a file above the calling script.

doc_CodeIgniter
2016-10-15 16:32:35
Comments
Leave a Comment

Please login to continue.