日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程语言 > php >内容正文

php

php yii2 finfo file,FileHelper:文件系统助手

發布時間:2024/1/23 php 30 豆豆
生活随笔 收集整理的這篇文章主要介紹了 php yii2 finfo file,FileHelper:文件系统助手 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

#### FileHelper::createDirectory() 方法創建一個新目錄.

~~~

/**

* @param string $path 要創建的目錄的路徑.

* @param int $mode 為新創建目錄設置權限.

* @param bool $recursive 如果父目錄不存在, 是否創建父目錄.

* @return bool 是否成功創建目錄.

*/

FileHelper::createDirectory($path, $mode = 0775, $recursive = true);

~~~

#### FileHelper::removeDirectory() 方法遞歸刪除目錄(及其所有內容).

~~~

/**

* @param string $dir 要遞歸刪除的目錄.

* @param array $options 刪除目錄的選項. 有效的選項有:

* - traverseSymlinks: boolean, 是否應該遍歷目錄的快捷方式.

* 默認為`false`, 意味著只會刪除快捷方式, 而不刪除快捷方式目錄里的內容.

*/

FileHelper::removeDirectory($dir, $options = []);

~~~

#### FileHelper::copyDirectory() 方法將整個目錄復制為另一個目錄.

~~~

/**

* Copies a whole directory as another one.

* The files and sub-directories will also be copied over.

* @param string $src 源目錄.

* @param string $dst 目的目錄.

* @param array $options 復制目錄的選項. 有效的選項有:

* - dirMode: integer, the permission to be set for newly copied directories. Defaults to 0775.

* - fileMode: integer, the permission to be set for newly copied files. Defaults to the current environment setting.

* - filter: callback, a PHP callback that is called for each directory or file.

* The signature of the callback should be: `function ($path)`, where `$path` refers the full path to be filtered.

* The callback can return one of the following values:

*

* * true: the directory or file will be copied (the "only" and "except" options will be ignored)

* * false: the directory or file will NOT be copied (the "only" and "except" options will be ignored)

* * null: the "only" and "except" options will determine whether the directory or file should be copied

*

* - only: array, list of patterns that the file paths should match if they want to be copied.

* A path matches a pattern if it contains the pattern string at its end.

* For example, '.php' matches all file paths ending with '.php'.

* Note, the '/' characters in a pattern matches both '/' and '\' in the paths.

* If a file path matches a pattern in both "only" and "except", it will NOT be copied.

* - except: array, list of patterns that the files or directories should match if they want to be excluded from being copied.

* A path matches a pattern if it contains the pattern string at its end.

* Patterns ending with '/' apply to directory paths only, and patterns not ending with '/'

* apply to file paths only. For example, '/a/b' matches all file paths ending with '/a/b';

* and '.svn/' matches directory paths ending with '.svn'. Note, the '/' characters in a pattern matches

* both '/' and '\' in the paths.

* - caseSensitive: boolean, whether patterns specified at "only" or "except" should be case sensitive. Defaults to true.

* - recursive: boolean, whether the files under the subdirectories should also be copied. Defaults to true.

* - beforeCopy: callback, a PHP callback that is called before copying each sub-directory or file.

* If the callback returns false, the copy operation for the sub-directory or file will be cancelled.

* The signature of the callback should be: `function ($from, $to)`, where `$from` is the sub-directory or

* file to be copied from, while `$to` is the copy target.

* - afterCopy: callback, a PHP callback that is called after each sub-directory or file is successfully copied.

* The signature of the callback should be: `function ($from, $to)`, where `$from` is the sub-directory or

* file copied from, while `$to` is the copy target.

* - copyEmptyDirectories: boolean, whether to copy empty directories. Set this to false to avoid creating directories

* that do not contain files. This affects directories that do not contain files initially as well as directories that

* do not contain files at the target destination because files have been filtered via `only` or `except`.

* Defaults to true. This option is available since version 2.0.12. Before 2.0.12 empty directories are always copied.

*/

FileHelper::copyDirectory($src, $dst, $options = []);

~~~

總結

以上是生活随笔為你收集整理的php yii2 finfo file,FileHelper:文件系统助手的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。