Hướng dẫn php file_get_contents get size
(PHP 4 >= 4.3.0, PHP 5, PHP 7, PHP 8) file_get_contents — Reads entire file into a string Descriptionfile_get_contents( file_get_contents() is the preferred way to read the contents of a file into a string. It will use memory mapping techniques if supported by your OS to enhance performance.
Parametersfilename Name of the file to read. use_include_path
context A valid context resource created with
stream_context_create(). If you don't need to use a custom context, you can skip this parameter by offset The offset where the reading starts on the original stream. Negative offsets count from the end of the stream. Seeking ( length Maximum length of data read. The default is to read until end of file is reached. Note that this parameter is applied to the stream processed by the filters. Return Values The function returns the read data or Warning This
function may return Boolean Errors/Exceptions An When file_get_contents() is called on a directory, an Changelog
ExamplesExample #1 Get and output the source of the homepage of a website
Example #2 Searching within the include_path
Example #3 Reading a section of a file
The above example will output something similar to: string(14) "lle Bjori Ro" Example #4 Using stream contexts
Notes
Tip A URL can be used as a filename with this function if the fopen wrappers have been enabled. See fopen() for more details on how to specify the filename. See the Supported Protocols and Wrappers for links to information about what abilities the various wrappers have, notes on their usage, and information on any predefined variables they may provide. Warning When using SSL, Microsoft IIS will violate the protocol by closing the connection without sending a See Also
Bart Friederichs ¶ 10 years ago
= array('http' =>
453034559 at qq dot com ¶ 1 year ago
Anonymous ¶ 1 year ago
allenmccabe at gmail dot com ¶ 1 year ago
|