使用Directory迭代器函数,我会得到不同的结果,具体取决于路径名和其他内容?

I am trying to read filenames from two directories. It works for one pathname but the other just gives me the files at the root (not the pathname I selected). So the first part gives the files under C:/TEMP/TEST but if fails to do so with the following directory; it just gives me the files located at C:/TEMPO and not C:TEMPO/TEST.

I am new to php, Thanks.

<?php

$dd = 0;
$ee = 0;
$HALLO1 = 'C:/TEMP/TEST';

foreach ($CC1 as $directory)  {
   //$DD1 = ($CC1[$dd]);
   $GG1 = strval($CC1[$dd]);
   $HALLO1 = $GG1;

   echo "HALLO1" . $HALLO1 ;
   $iterator = new DirectoryIterator(dirname($HALLO1));
   foreach ($iterator as $fileinfo) {

   echo $fileinfo->getFilename() . "
";
   $isidor[$ee] = $filename1;
   echo "isidor" .  $dd . $filename1 . "
"; 
 ++$ee;
  }


  $vv = 0;
 $ww = 0;
 $HALLO2 = 'C:/TEMPO/TEST';

 foreach ($CC2 as $directory2)  {

     $iterator = new DirectoryIterator(dirname($HALLO2));
 foreach ($iterator as $fileinfo) {

      echo $fileinfo->getFilename() . "
";
      $heli [$ww] = $filename2;
      echo "heli" .  $vv . $filename2 ;
   ++$ww;
  }

 ?>