Feature: walker function: walker(".") returns an object model of the entire directory / an expansive alternative for scandir()
未关闭
还没有人认领这个 Issue。
Feature
Status: Needs Triage
- 主要语言
- C
- 星标
- 40.4k
- 派生
- 8.1k
- 平均合并
- 2 天 13 小时
- 30 天内合并 PR
- 96
描述
Description
Here is my current code for demonstrating the purpose. The dev community shall decide on the final verdict.
<?php
function walker($directory) {
foreach (scandir($directory) as $item) {
if ($item == '.' || $item == '..') continue;
if ($directory == "." && ($item == "api.php" || $item == 'index.html')) continue;
$dl[$item] = [
"item_type" => is_dir("{$directory}/{$item}") ? "folder" : "file",
"child" => walker("{$directory}/{$item}"),
];
}
return $dl;
}
?>
Here's how I'm currently using it :) with some html css and js
How it looks like when I use echo and json_encode.
I'll be making a pull request if it got a lot of good impressions.
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
首先审查提议的 walker($directory) 示例及其用于递归遍历目录的预期对象模型。将该请求与现有的 scandir() 行为进行比较,并确定是否可以定义具体的 PHP API、范围和完成标准;该 issue 目前未指定源文件或测试。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- php
- 领域
- backend
- Issue 类型
- 功能
- 难度
- 5/5
- 预计耗时
- 一周以上
- 活跃度
- 冷清
- 描述清晰度
- 需要澄清
- 新手友好度
- 25/100