Php 使用opendir列出父目录的文件夹不起作用

Php 使用opendir列出父目录的文件夹不起作用,php,parent,opendir,Php,Parent,Opendir,以下脚本适用于当前目录: <?php $ignore = array ('.', '..', '.DS_Store', 'index.php'); $num_ordnernamen = array (); if ($handle = opendir('./')) { while (false !== ($entry = readdir($handle))) { if (!in_array($entry, $ignore) &&

以下脚本适用于当前目录:

<?php    
$ignore = array ('.', '..', '.DS_Store', 'index.php');
    $num_ordnernamen = array ();
    if ($handle = opendir('./')) {
    while (false !== ($entry = readdir($handle))) {
        if (!in_array($entry, $ignore) && is_dir($entry)) {
        array_push($num_ordnernamen, $entry);
        }
    }
    }
    print_r ($num_ordnernamen); 
?>
然而,这对我们来说并不管用

if ($handle = opendir('../')) //or
if ($handle = opendir('..')) //or
if ($handle = opendir('../..'))
…或者其他我想提高一级的东西。我在这里遗漏了什么?

  • 您有读取父目录的权限吗
  • 您是否已激活错误报告
  • 您的父目录中有目录吗?(您的代码仅打印目录)
if ($handle = opendir('../')) //or
if ($handle = opendir('..')) //or
if ($handle = opendir('../..'))