fs¶
-
php\lib\fs File System class.
Class fs
Methods
- static
separator¶Return the local filesystem’s name-separator character.
Результат: string
- static
pathSeparator¶Return the local filesystem’s path-separator character.
Результат: string
- static
valid($name)¶Validate file name.
Параметры:
- $name –
Результат:
bool
- static
abs($path)¶Returns absolute real path.
Параметры:
- $path –
Результат:
string
- static
name($path)¶
Параметры:
- $path –
Результат:
string
- static
nameNoExt($path)¶
Параметры:
- $path –
Результат:
string
- static
pathNoExt($path)¶Returns path without extension.
Параметры:
- $path –
stringРезультат:
string
- static
ext($path)¶Returns extension of path.
Параметры:
- $path –
Результат:
string
- static
hasExt($path, $extensions = null, $ignoreCase = true)¶Check that $path has an extension from the extension set.
Параметры:
- $path –
string- $extensions –
string,array- $ignoreCase –
boolРезультат:
bool
- static
parent($path)¶Returns parent directory.
Параметры:
- $path –
Результат:
string
- static
ensureParent($path)¶Checks parent of path and if it is not exists, tries to create parent directory. See makeDir().
Параметры:
- $path –
stringРезультат:
bool
- static
normalize($path)¶Normalizes file path for current OS.
Параметры:
- $path –
Результат:
string
- static
exists($path)¶
Параметры:
- $path –
Результат:
string
- static
size($path)¶Returns size of file in bytes.
Параметры:
- $path –
Результат:
int
- static
isFile($path)¶
Параметры:
- $path –
Результат:
bool
- static
isDir($path)¶
Параметры:
- $path –
Результат:
bool
- static
isHidden($path)¶
Параметры:
- $path –
Результат:
bool
- static
time($path)¶Returns last modification time of file or directory.
Параметры:
- $path –
Результат:
int
- static
makeDir($path)¶Creates empty directory (mkdirs) if not exists.
Параметры:
- $path –
Результат:
bool
- static
makeFile($path)¶Creates empty file, if file already exists then rewrite it.
Параметры:
- $path –
Результат:
bool
- static
delete($path)¶Deletes file or empty directory.
Параметры:
- $path –
Результат:
bool
- static
clean($path, $checker = null)¶Deletes all files in path. This method does not delete the $path directory. Returns array with error, success and skip file list.
Параметры:
- $path –
string- $checker –
callable- (File $file, $depth) optional, must return true to delete the file.Результат:
array[success => [], error => [], skip = []]
- static
scan($path, $onProgress, $maxDepth = 0, $subIsFirst = false)¶
Параметры:
- $path –
string- $onProgress –
callable- (File $file, $depth)- $maxDepth –
int- if 0 then unlimited.- $subIsFirst –
bool
- static
hash($source, $algo = 'MD5')¶Calculates hash of file or stream.
Параметры:
- $source –
string, php\io\Stream- $algo –
string- MD5, MD2, SHA-1, SHA-256, SHA-512Результат:
string
- static
copy($source, $dest, $onProgress = null)¶Copies $source stream to $dest stream.
Параметры:
- $source –
string, php\io\File, php\io\Stream- $dest –
string, php\io\File, php\io\Stream- $onProgress –
callable- ($copiedBytes)Результат:
intcopied bytes.
- static
get($source, $charset = null, $mode = 'r')¶Reads fully data from source and returns it as binary string.
Параметры:
- $source –
string- $charset –
null,string- UTF-8, windows-1251, etc.- $mode –
stringРезультат:
string