当前位置: 首页> 函数类别大全> 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.
同类函数
  • 获取文件的最后访问时间  fileatime

    fileatime

    获取文件的最后访问时间
  • 获取文件修改时间  filemtime

    filemtime

    获取文件修改时间
  • 解析配置字符串  parse_ini_string

    parse_ini_string

    解析配置字符串
  • disk_free_space 的别名  diskfreespace

    diskfreespace

    disk_free_space的别名
  • 获取文件权限  fileperms

    fileperms

    获取文件权限
  • 判断给定文件名是否为一个符号连接  is_link

    is_link

    判断给定文件名是否为一个符号连接
  • 返回文件路径的信息  pathinfo

    pathinfo

    返回文件路径的信息
  • 删除文件  unlink

    unlink

    删除文件