mutant/file

此包的最新版本(dev-master)没有可用的许可证信息。

mutant 共享包。

dev-master 2018-01-03 20:54 UTC

This package is not auto-updated.

Last update: 2024-09-20 07:26:26 UTC


README

共享文件助手函数

安装

  1. composer require mutant/file

注意:在我制作实际文档之前,所有文档都在docblocks中。

一般说明

  1. 文件模式
r	Read only mode, with the file pointer at the start of the file.
r+	Read/Write mode, with the file pointer at the start of the file.
w	Write only mode. Truncates the existing file by overwriting it. If file doesn’t exist the fopen() function creates a new file.
w+	Read/Write mode. Truncates the existing file by overwriting it. If file doesn’t exist the fopen() function creates a new file.
a	Append mode, with the file pointer at the end of the file. If the file doesn’t exist, the fopen() function creates a new file.
a+	Read/Append mode, with the file pointer at the end of the file. If the file doesn’t exist, the fopen() function creates a new file.
x	Create and open for writing only. If the file exists already, it returns FALSE and generates an error. If file doesn’t exist, a new file is created.
x+	Create and open for reading and writing. If the file exists already, it returns FALSE and generates an error. If file doesn’t exist, a new file is created.
  1. 原始php文件函数
  • fopen() 用于打开文件,如果文件存在则打开,如果不存在则创建。
    • 如果 fopen() 函数无法创建文件或打开文件,则返回 0(零)。
  • fclose() 用于关闭打开的文件
    • fclose() 函数在成功时返回 true,在失败时返回 false