Home >Backend Development >PHP Tutorial >A simple way to get a directory list in php, get a directory list in php_PHP tutorial

A simple way to get a directory list in php, get a directory list in php_PHP tutorial

WBOY
WBOYOriginal
2016-07-13 10:01:07956browse

A simple way to get a directory list in php, get a directory list in php

The example in this article describes a simple way to get a directory list in php. Share it with everyone for your reference. The specific implementation method is as follows:

<&#63;php
 function list_directory_content($dir){
  if(is_dir($dir)){
   if($handle = opendir($dir)){
    while(($file = readdir($handle)) !== false){
     if($file != '.' && $file != '..' && $file != '.htaccess'){
      echo '<a target="_blank" href="'.$dir.$file.'">'
       .$file.'</a><br>'."\n";
     }
    }
    closedir($handle);
   }
  }
 }
&#63;>

I hope this article will be helpful to everyone’s PHP programming design.

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/972627.htmlTechArticleA simple way to get a directory list in php, a simple way to get a directory list in php. This article describes an example of a simple way to get a directory list in php. Share it with everyone for your reference. The specific implementation method is as follows:...
Statement:
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