(PHP 5, PHP 7)
stream_get_contents — 读取资源流到一个字符串
$handle
   [, int $maxlength = -1
   [, int $offset = -1
  ]] ) : string
   与 file_get_contents() 一样,但是
    stream_get_contents() 是对一个已经打开的资源流进行操作,并将其内容写入一个字符串返回。
   返回的内容取决于 maxlength 字节长度和 offset 指定的起始位置。
  
   返回一个字符串  或者在失败时返回 FALSE.
  
| 版本 | 说明 | 
|---|---|
| 5.1.0 | 增加参数 offset。 | 
Example #1 stream_get_contents() 例子
<?php
if ($stream = fopen('http://www.example.com', 'r')) {
    // print all the page starting at the offset 10
    echo stream_get_contents($stream, -1, 10);
    fclose($stream);
}
if ($stream = fopen('http://www.example.net', 'r')) {
    // print the first 5 bytes
    echo stream_get_contents($stream, 5);
    fclose($stream);
}
?>
Note: 此函数可安全用于二进制对象。