本文整理汇总了PHP中dir::ignore方法的典型用法代码示例。如果您正苦于以下问题:PHP dir::ignore方法的具体用法?PHP dir::ignore怎么用?PHP dir::ignore使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类dir
的用法示例。
在下文中一共展示了dir::ignore方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: read
public function read($url = '', $recursive = false, $format = 'flat')
{
if (substr($url, -1) !== Application::DS) {
$url .= Application::DS;
}
if ($this->ignore('find', $url)) {
return array();
}
$list = array();
$cwd = getcwd();
chdir($url);
if ($handle = opendir($url)) {
while (false !== ($entry = readdir($handle))) {
$recursiveList = array();
if ($entry == '.' || $entry == '..') {
continue;
}
$file = new stdClass();
$file->url = $url . $entry;
if (is_dir($file->url)) {
$file->url .= Application::DS;
$file->type = 'dir';
}
if ($this->ignore('find', $file->url)) {
continue;
}
$file->name = $entry;
if (isset($file->type)) {
if (!empty($recursive)) {
$directory = new dir();
$directory->ignore('list', $this->ignore());
$recursiveList = $directory->read($file->url, $recursive, $format);
if ($format !== 'flat') {
$file->list = $recursiveList;
unset($recursiveList);
}
}
} else {
$file->type = 'file';
}
if (is_link($entry)) {
$file->link = true;
}
/* absolute url is_link wont work probably the targeting type
if(is_link($file->url)){
$file->link = true;
}
*/
$list[] = $file;
if (!empty($recursiveList)) {
foreach ($recursiveList as $recursive_nr => $recursive_file) {
$list[] = $recursive_file;
}
}
}
}
closedir($handle);
return $list;
}