glob函数 循环遍历子目录下的文件

<?php 

foreach (glob("ueditor\php\upload\image\*\*.png") as $filename) { 

   echo "$filename size " . filesize($filename) . "\n"; 

} 

?> 

 

<?php 



$file = "ueditor\php\upload\image\*\*.png";

foreach (glob("$file") as $filename) 

{

   echo "<img src=\"".$filename."\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";

   echo "<a href=\"".$filename."\">".$filename."</a><br/><br/><br/>";

  

}





//foreach (glob("*.txt") as $filename) {

   //echo "$filename size " . filesize($filename) . "\n";

   //unlink($filename);

//}





//array_map('unlink', glob("*.txt")); 





//$file = "ueditor\php\upload\image\*\*.png";

//foreach (glob("$file") as $filename) 

//{

   //echo "<img src=\"".$filename."\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";

   //echo "<a href=\"".$filename."\">".$filename."</a><br/><br/><br/>";

   

//}





//foreach (glob("ueditor\php\upload\image\*\*.png") as $filename) 

//{

   //echo "<a href=\"".$filename."\">".$filename."</a><br/>";

//}





//foreach (glob("ueditor\php\upload\image\*\*.png") as $filename) { 

   //echo "$filename size " . filesize($filename) . "\n"; 

//} 





?> 
<script type="text/javascript" src="tp.php?action=test"></script> 

 

你可能感兴趣的:(文件)