【发布时间】:2013-01-26 05:12:09
【问题描述】:
我需要获取目录中所有可用的子目录,保存该目录的名称,如果它们包含 XML 文件,则使用该文件。
这是我写的一些代码和一些 cmets。
<?php
$path = "http://source.com/path/to/subs/";
//Check for any subdirectories
foreach($subdirectory as $sub){
$name = //subdirectory's name;
// Filepath is always http://source.com/path/to/subs/name_of_sub/description.xml
$file = $path . $name . 'description.xml';
if(file_exists($file)){
//do my stuff here
}
}
//end check
?>
【问题讨论】:
-
许多 PHP 函数:opendir、readdir、glob、scandir ...
标签: php recursion directory subdirectory