当前位置: 首页> 函数类别大全> file_get_contents

file_get_contents

将整个文件读入一个字符串
名称:file_get_contents
分类:文件系统
所属语言:php
一句话介绍:将文件读入字符串。

实例

<span class="token php language-php"><span class="token delimiter important"><?php</span>
<span class="token keyword">echo</span> <span class="token function">file_get_contents</span><span class="token punctuation">(</span><span class="token string double-quoted-string">"test.txt"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token delimiter important">?></span></span>

输出:

This is a test file with test text.
同类函数
  • 获取真实路径缓冲区的大小  realpath_cache_size

    realpath_cache_size

    获取真实路径缓冲区的大小
  • 建立一个具有唯一文件名的文件  tempnam

    tempnam

    建立一个具有唯一文件名的文件
  • 返回符号链接的目标  readlink

    readlink

    返回符号链接的目标
  • 寻找与模式匹配的文件路径  glob

    glob

    寻找与模式匹配的文件路径
  • 将文件截断到给定的长度  ftruncate

    ftruncate

    将文件截断到给定的长度
  • 用模式匹配文件名  fnmatch

    fnmatch

    用模式匹配文件名
  • 拷贝文件  copy

    copy

    拷贝文件
  • 返回规范化的绝对路径名  realpath

    realpath

    返回规范化的绝对路径名