read_file()
read_file(string $file) : string
Read File
Opens the file specified in the path and returns it as a string.
Parameters
string | $file | Path to file |
Returns
string —File contents
CodeIgniter
An open source application development framework for PHP
This content is released under the MIT License (MIT)
Copyright (c) 2014 - 2017, British Columbia Institute of Technology
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
write_file(string $path, string $data, string $mode = 'wb') : boolean
Write File
Writes data to the file specified in the path. Creates a new file if non-existent.
string | $path | File path |
string | $data | Data to write |
string | $mode | fopen() mode (default: 'wb') |
package |
CodeIgniter |
---|
delete_files(string $path, boolean $del_dir = FALSE, boolean $htdocs = FALSE, integer $_level) : boolean
Delete Files
Deletes all files contained in the supplied directory path. Files must be writable or owned by the system in order to be deleted. If the second parameter is set to TRUE, any directories contained within the supplied base directory will be nuked as well.
string | $path | File path |
boolean | $del_dir | Whether to delete any directories found in the path |
boolean | $htdocs | Whether to skip deleting .htaccess and index page files |
integer | $_level | Current directory depth level (default: 0; internal use only) |
package |
CodeIgniter |
---|
get_filenames( $source_dir, $include_path = FALSE, $_recursion = FALSE) : array
Get Filenames
Reads the specified directory and builds an array containing the filenames. Any sub-folders contained within the specified path are read as well.
$source_dir | ||
$include_path | ||
$_recursion |
package |
CodeIgniter |
---|
get_dir_file_info( $source_dir, $top_level_only = TRUE, $_recursion = FALSE) : array
Get Directory File Information
Reads the specified directory and builds an array containing the filenames, filesize, dates, and permissions
Any sub-folders contained within the specified path are read as well.
$source_dir | ||
$top_level_only | ||
$_recursion |
package |
CodeIgniter |
---|
get_file_info( $file, $returned_values = array('name', 'server_path', 'size', 'date')) : array
Get File Info
Given a file and path, returns the name, path, size, date modified Second parameter allows you to explicitly declare what information you want returned Options are: name, server_path, size, date, readable, writable, executable, fileperms Returns FALSE if the file cannot be found.
$file | ||
$returned_values |
package |
CodeIgniter |
---|
get_mime_by_extension(string $filename) : string
Get Mime by Extension
Translates a file extension into a mime type based on config/mimes.php. Returns FALSE if it can't determine the type, or open the mime config file
Note: this is NOT an accurate way of determining file mime types, and is here strictly as a convenience It should NOT be trusted, and should certainly NOT be used for security
string | $filename | File name |
package |
CodeIgniter |
---|
symbolic_permissions(integer $perms) : string
Symbolic Permissions
Takes a numeric value representing a file's permissions and returns standard symbolic notation representing that value
integer | $perms | Permissions |
package |
CodeIgniter |
---|
Loading…