本文整理汇总了PHP中RecursiveDirectoryIterator::getPathname方法的典型用法代码示例。如果您正苦于以下问题:PHP RecursiveDirectoryIterator::getPathname方法的具体用法?PHP RecursiveDirectoryIterator::getPathname怎么用?PHP RecursiveDirectoryIterator::getPathname使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RecursiveDirectoryIterator
的用法示例。
在下文中一共展示了RecursiveDirectoryIterator::getPathname方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getAllSubDirectory
/**
* Get all sub directory
* @param string $path The base path want to find
* @return array Array of path of sub directory founded
*/
public static function getAllSubDirectory($path)
{
$rdi = new RDIterator($path, RDIterator::SKIP_DOTS);
$subDirs = [];
foreach ($rdi as $item) {
if ($item->isDir()) {
$subDirs[] = $rdi->getPathname();
}
}
return $subDirs;
}
示例2: array
mysql_connection_select(DATABASE);
// set parameter defaults
$formImportDir = @$_REQUEST['formImportDir'];
// outName returns the hml direct.
$resourceUriRoot = @$_REQUEST['resourceUriRoot'];
// URI prefix for the resources upload with forms.
//if no style given then try default, if default doesn't exist we our put raw xml
$importData = array();
$info = new SplFileInfo($formImportDir);
$i = 0;
$xmlForms = array("form" => array(), "resource" => array());
if ($info->isDir()) {
$iterator = new RecursiveDirectoryIterator($formImportDir);
while ($iterator->valid()) {
if ($iterator->isFile()) {
$ext = pathinfo($iterator->getPathname(), PATHINFO_EXTENSION);
if ($ext == "xml") {
// echo $prefix,$j," import ",$dirIterator->getPathname(), "<br>\n";
$xmlForms["form"][$iterator->getFilename()] = $iterator->getPathname();
} else {
$filepath = preg_replace("/" . preg_replace("/\\//", "\\\\/", HEURIST_UPLOAD_DIR) . "/", "/", $iterator->getPathname());
// echo $prefix,$j," resource ".$dirIterator->getFilename()." has path ".$filepath, "<br>\n";
$xmlForms["resource"][$iterator->getFilename()] = $filepath;
}
} else {
if ($iterator->isDir() && $iterator->hasChildren(false)) {
// echo $i,pathinfo($iterator->getPathname(),PATHINFO_FILENAME), "<br>\n";
processChildDir($iterator->getChildren(), $i . "-");
}
}
$iterator->next();