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

WBOY
Release: 2016-07-13 10:01:07
Original
930 people have browsed it

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;>
Copy after login

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:...
Related labels:
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