weew/helpers-filesystem

实用文件系统辅助函数集合。

v1.2.1 2016-07-21 11:18 UTC

This package is not auto-updated.

Last update: 2024-09-10 22:07:31 UTC


README

Build Status Test Coverage Version Licence

目录

安装

composer require weew/helpers-filesystem

介绍

这个小巧的库提供了各种辅助函数,以简洁、简便的方式处理文件和目录。

函数

file_get_directory

获取文件目录的名称。

string file_get_directory(string $path)

file_get_extension

获取文件目录的名称。

string file_get_extension(string $path)

file_get_name

获取文件目录的名称。

string file_get_name(string $path)

file_read

读取文件内容。

mixed file_read(string $path)

file_create

创建文件及其所有必要的子目录。

bool file_create(string $path)

file_write

向文件中写入内容。

bool file_write(string $path, string $content)

file_append

将内容追加到文件的末尾。

bool file_append(string $path, string $content)

file_prepend

将内容追加到文件的开始。

bool file_prepend(string $path, string content)

file_delete

删除文件。

bool file_delete(string $path)

file_rename

将文件从一个位置移动到另一个位置,并创建所有必要的子目录。

bool file_rename(string $oldPath, string $newPath)

file_copy

将文件从一个位置复制到另一个位置,并创建所有必要的子目录。

bool file_copy(string $oldPath, string $newPath)

file_rename

重命名指定路径的文件。

bool file_rename(string $path, $newName)

directory_get_name

获取文件目录的名称。

string directory_get_name(string $path)

directory_get_parent

获取父目录的路径。

string directory_get_parent(string $path)

directory_create

创建目录及其所有子目录。

bool directory_create(string $path [, $mode = 0777])

directory_delete

删除目录及其所有文件。

bool directory_delete(string $path)

directory_exists

检查目录是否存在。

bool directory_exists(string $path)

directory_rename

重命名目录。

bool directory_rename(string $path, string $newName)

directory_move

将目录移动到指定的路径。

bool directory_move(string $oldPath, string $newPath)

directory_copy

将目录及其所有内容复制到指定的路径,并创建所有必要的子目录。

bool directory_copy(string $oldPath, string $newPath)

directory_clear

删除目录内部的所有文件和目录。

directory_clear(string $path)

directory_list

返回文件和目录的列表。 $absolute 表示路径是相对的还是绝对的。

string[] directory_list(string $path [, $absolute = false])

directory_list_files

返回文件列表。 $absolute 表示路径是相对的还是绝对的。

string[] directory_list_files(string $path [, $absolute = false])

directory_list_directories

返回目录列表。 $absolute 表示路径是相对的还是绝对的。

string[] directory_list_directories(string $path [, $absolute = false])