Home > Backend Development > PHP Tutorial > Detailed explanation of how to use PHP to list all files under a directory_PHP Tutorial

Detailed explanation of how to use PHP to list all files under a directory_PHP Tutorial

WBOY
Release: 2016-07-21 15:04:32
Original
974 people have browsed it

Give the source code directly:

Copy the code The code is as follows:

$current_dir = 'E: /temp/';
$dir = opendir($current_dir);
echo "direcotry list:
    ";
    while(false !== ($file=readdir($dir)) ){
    if($file != "." && $file != ".."){
    echo "
  • $file
  • ";
    }
    }
    echo "
";
closedir($dir);

If it is the same drive letter as the web, just write: $current_dir='/temp/ ';That's it.

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/327776.htmlTechArticle gives the source code directly: Copy the code as follows: $current_dir = 'E:/temp/'; $dir = opendir($current_dir); echo "direcotry list:ul"; while(false !== ($file=readdir($dir))){ if($f...
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template