函数名称:file_get_contents() 适用版本:PHP 4, PHP 5, PHP 7
函数描述:file_get_contents() 函数将整个文件读入一个字符串中。
语法:string file_get_contents ( string $filename [, bool $use_include_path = FALSE [, resource $context [, int $offset = -1 [, int $maxlen ]]]] )
参数:
返回值:返回包含文件内容的字符串,如果出错则返回 FALSE。
示例:
$file_content = file_get_contents('path/to/file.txt');
echo $file_content;
$url = 'https://example.com/data.txt';
$file_content = file_get_contents($url);
echo $file_content;
$file_content = file_get_contents('path/to/file.txt', false, null, 10);
echo $file_content;
注意事项: