Skip to content

Commit

Permalink
update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
crazywhalecc committed Aug 3, 2022
1 parent b94bbbc commit af75fc2
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 6 deletions.
2 changes: 1 addition & 1 deletion docs/.vuepress/api.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions docs/api/ZM/Utils/DataProvider.md
Original file line number Diff line number Diff line change
Expand Up @@ -158,21 +158,21 @@ public function loadFromJson(string $filename): null|mixed
## scanDirFiles

```php
public function scanDirFiles(string $dir, bool $recursive, bool|string $relative, bool $include_dir): array|false
public function scanDirFiles(string $dir, bool $recursive, bool|mixed|string $relative, bool $include_dir): array|false
```

### 描述

递归或非递归扫描目录,可返回相对目录或绝对目录的文件或目录列表
递归或非递归扫描目录,可返回相对目录的文件列表或绝对目录的文件列表

### 参数

| 名称 | 类型 | 描述 |
| -------- | ---- | ----------- |
| dir | string | 目录 |
| recursive | bool | 是否递归扫描子目录 |
| relative | bool|string | 是否返回相对目录,如果为true则返回相对目录,如果为false则返回绝对目录 |
| $include_dir | bool | 如果为true则返回目录,为false则只返回文件
| relative | bool|mixed|string | 是否返回相对目录,如果为true则返回相对目录,如果为false则返回绝对目录 |
| include_dir | bool | 非递归模式下,是否包含目录 |

### 返回

Expand Down
4 changes: 3 additions & 1 deletion docs/component/store/data-provider.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,12 @@ DataProvider::getDataFolder("TestModule"); // 例如返回 /root/zhamao-framewor

递归或非递归扫描目录,返回相对目录的文件列表或绝对目录的文件列表。(非常好用)

定义:`scanDirFiles($dir, $recursive = true, $relative = false)`
定义:`scanDirFiles($dir, $recursive = true, $relative = false, $include_dir = false)`

`$dir` 为要扫描的目录,`$recursive` 为是否递归,`$relative` 为是否返回相对目录的文件列表。

`$include_dir` 只有在 `$recursive === false` 的情况才生效,当 `$include_dir``true` 时,返回的非递归文件列表会包含目录,否则只包含文件。

从给定的目录下开始遍历整个目录,如果将 `$recursive` 设置为 `true`,则会递归扫描子目录,否则将返回包含目录的文件列表。

如果将 `$relative` 设置为 `true`,则会返回文件列表的相对路径,否则返回绝对路径。
Expand Down
4 changes: 4 additions & 0 deletions docs/update/build-update.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@

同时此处将只使用 build 版本号进行区分。

## build 476 (2022-8-3)

- `DataProvider::scanDirFiles()` 新增参数 `$include_dir`,用于控制非递归模式下是否包含目录

## build 475 (2022-7-3)

- 修复 `match_args` 全局方法对于 `0` 字符串处理的 Bug(#136
Expand Down
6 changes: 6 additions & 0 deletions docs/update/v2.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# 更新日志(v2 版本)

## v2.8.2(build 476)

> 更新时间:2022.8.3
- `DataProvider::scanDirFiles()` 新增参数 `$include_dir`,用于控制非递归模式下是否包含目录

## v2.8.1(build 475)

> 更新时间:2022.7.3
Expand Down

0 comments on commit af75fc2

Please sign in to comment.