本文整理汇总了PHP中Dir::getDir方法的典型用法代码示例。如果您正苦于以下问题:PHP Dir::getDir方法的具体用法?PHP Dir::getDir怎么用?PHP Dir::getDir使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Dir
的用法示例。
在下文中一共展示了Dir::getDir方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: ls
static function ls($path)
{
$ipath = implode("/", $path);
$r = new ResultSet();
$dImages = new Dir(self::ROOT);
$dir = $dImages->getDir($ipath);
$dirs = $dir->ls(null, DIR::LS_DIR);
$r->f("#dirs")->count(count($dirs))->f("#parent > whyperlink")->href(array_merge(array_slice($path, 0, -1), array(null)));
foreach ($dirs as $k => $d) {
$l = substr($d, strlen($dImages));
$r->f("#cd > whyperlink", $k)->href(explode('/', $l))->f("#ddel", $k)->additional_id($d->getName())->f("#cd wtext", $k)->text($d->getName());
}
$fc = 0;
foreach ($dir->ls() as $k => $f) {
$df = new MimeDecorator(new StatDecorator($f));
//if(strpos($df->getMime(),"image") === false) continue;
try {
$df = new ImageDecorator($df);
} catch (DecoratorException $e) {
continue;
}
$stat = $df->stat();
@$r->f("#fname", $k)->text($df->getName())->f("#fdel", $k)->additional_id($df->getName())->f("#stat", $k)->text($df->getWidth() . "×" . $df->getHeight() . " " . date("Y/m/d H:i", $stat['mtime']) . " " . sizeToString($stat['size']))->f("#preview", $k)->file($df)->f("#choose > whyperlink", $k)->href($df->getURL());
$fc++;
}
$r->f("#files")->count($fc);
return $r;
}
示例2: FileUpadter
function FileUpadter()
{
FileSystemObject::setRoot(dirname(__FILE__));
$d = new Dir('files');
$fu = new FileUpdater($d->getDir('source/includes'), $d->getDir('target/includes'), $d->getDir('backup/includes'));
$command = ArgsHolder::get()->shiftCommand();
if ($command == 'cdo') {
$fu->copyDo();
} elseif ($command == 'cundo') {
$fu->copyUndo();
} elseif ($command == 'undo') {
$fu->undo();
} elseif ($command == 'do') {
$fu->run();
} else {
io::out('command not found');
}
}