What is "file-get-contents"
This function is similar to file()
, except that file_get_contents()
returns the file in a string, starting from offset to maxlen bytes. In case of failure, file_get_contents()
will return FALSE
.
file_get_contents()
is the preferred method to read the contents of a file in a string. It uses memory mapping techniques supported by your OS to improve performance.
Note: If you are opening a URI with special characters, such as spaces, you need to encode the URI with urlencode().