abstract class FileSystem

Class FileSystem

Methods

static bool
isAbsPath(string $path)

No description

static bool
isAbsolutePath(string $file)

Returns whether the file path is an absolute path.

static string
pathFormat(string $dirName)

转换为标准的路径结构

string
clearPharPath(string $path)

No description

static array|string
exists(string $file, null|string $type = null)

检查文件/夹/链接是否存在

static 
check(string $file, null|string|array $ext = null)

No description

static 
rename(string $origin, string $target, bool $overwrite = false)

Renames a file or a directory.

static bool
isReadable(string $filename)

Tells whether a file exists and is readable.

static 
mkdir(string|array|Traversable $dirs, int $mode = 0777)

Creates a directory recursively.

static 
chmod(string|array|Traversable $files, int $mode, int $umask = 00, bool $recursive = false)

Change mode for an array of files or directories.

static 
chown(string|array|Traversable $files, string $user, bool $recursive = false)

Change the owner of an array of files or directories.

getIterator(string $srcDir, callable $filter)

No description

static bool
chmodDir(string $path, int $mode = 0664)

No description

static string
availableSpace(string $dir = '.')

No description

static string
countSpace(string $dir = '.')

No description

static int
pathModeInfo(string $file_path)

文件或目录权限检查函数

Details

at line 27
static bool isAbsPath(string $path)

Parameters

string $path

Return Value

bool

at line 49
static bool isAbsolutePath(string $file)

Returns whether the file path is an absolute path.

Parameters

string $file A file path

Return Value

bool

at line 64
static string pathFormat(string $dirName)

转换为标准的路径结构

Parameters

string $dirName

Return Value

string

at line 75
string clearPharPath(string $path)

Parameters

string $path e.g phar://E:/workenv/php-dockerized/www/phplang/ugirls-social/social-uem/uem.phar/web

Return Value

string

at line 94
static array|string exists(string $file, null|string $type = null)

检查文件/夹/链接是否存在

Parameters

string $file 要检查的目标
null|string $type

Return Value

array|string

at line 119
static check(string $file, null|string|array $ext = null)

Parameters

string $file
null|string|array $ext eg: 'jpg|gif'

Exceptions

FileNotFoundException
InvalidArgumentException

at line 145
static rename(string $origin, string $target, bool $overwrite = false)

Renames a file or a directory.

Parameters

string $origin The origin filename or directory
string $target The new filename or directory
bool $overwrite Whether to overwrite the target if it already exists

Exceptions

IOException When target file or directory already exists
IOException When origin cannot be renamed

at line 164
static bool isReadable(string $filename)

Tells whether a file exists and is readable.

Parameters

string $filename Path to the file

Return Value

bool

Exceptions

IOException When windows path is longer than 258 characters

at line 179
static mkdir(string|array|Traversable $dirs, int $mode = 0777)

Creates a directory recursively.

Parameters

string|array|Traversable $dirs The directory path
int $mode The directory mode

Exceptions

IOException On any directory creation failure

at line 210
static chmod(string|array|Traversable $files, int $mode, int $umask = 00, bool $recursive = false)

Change mode for an array of files or directories.

Parameters

string|array|Traversable $files A filename, an array of files, or a \Traversable instance to change mode
int $mode The new mode (octal)
int $umask The mode mask (octal)
bool $recursive Whether change the mod recursively or not

Exceptions

IOException When the change fail

at line 231
static chown(string|array|Traversable $files, string $user, bool $recursive = false)

Change the owner of an array of files or directories.

Parameters

string|array|Traversable $files A filename, an array of files, or a \Traversable instance to change owner
string $user The new owner user name
bool $recursive Whether change the owner recursively or not

Exceptions

IOException When the change fail

at line 255
static RecursiveIteratorIterator getIterator(string $srcDir, callable $filter)

Parameters

string $srcDir
callable $filter

Return Value

RecursiveIteratorIterator

at line 272
static bool chmodDir(string $path, int $mode = 0664)

Parameters

string $path
int $mode

Return Value

bool

at line 305
static string availableSpace(string $dir = '.')

Parameters

string $dir

Return Value

string

at line 322
static string countSpace(string $dir = '.')

Parameters

string $dir

Return Value

string

at line 342
static int pathModeInfo(string $file_path)

文件或目录权限检查函数

Parameters

string $file_path 文件路径

Return Value

int 返回值的取值范围为{0 <= x <= 15},每个值表示的含义可由四位二进制数组合推出。 返回值在二进制计数法中,四位由高到低分别代表 可执行rename()函数权限 |可对文件追加内容权限 |可写入文件权限|可读取文件权限。