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

file_put_contents

将数据写入文件
名称:file_put_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_put_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 string double-quoted-string">"Hello World. Testing!"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token delimiter important">?></span></span>

输出:

26
同类函数
  • 检查文件或目录是否存在  file_exists

    file_exists

    检查文件或目录是否存在
  • 返回文件系统或磁盘分区的总大小  disk_total_space

    disk_total_space

    返回文件系统或磁盘分区的总大小
  • 倒回文件指针的位置  rewind

    rewind

    倒回文件指针的位置
  • 取得文件的 inode  fileinode

    fileinode

    取得文件的inode
  • 用模式匹配文件名  fnmatch

    fnmatch

    用模式匹配文件名
  • 将上传的文件移动到新位置  move_uploaded_file

    move_uploaded_file

    将上传的文件移动到新位置
  • 参见 unlink() 或 unset()(PHP 没有 delete 关键词或函数)  delete

    delete

    参见unlink()或unset()(P
  • 将数据(但不是元数据)同步到文件  fdatasync

    fdatasync

    将数据(但不是元数据)同步到文件
热门文章