Home > Backend Development > PHP Tutorial > PHP code to read all files in a directory_PHP tutorial

PHP code to read all files in a directory_PHP tutorial

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-07-21 15:54:20
Original
908 people have browsed it

To read the code of all files in the directory, you can copy the code regardless of the file name

The code is as follows:

$dir = "file";

// Open a known directory, and proceed to read its contents
if (is_dir($dir)) {
if ($dh = opendir( $dir)) {

while (($file = readdir($dh)) !== false) {
if ($file!="." && $file!=".." ) {
echo "".$file."
";
} }
} }
closedir($dh);
}
}
?>

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/318545.htmlTechArticleRead the code of all files in the directory. You can copy the code regardless of the file name. The code is as follows: ?php $dir=" file"; //Openaknowndirectory,andproceedtoreaditscontents if(is_dir($dir)){ if($dh=op...
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
Latest Issues
PHP-Datenerfassung?
From 1970-01-01 08:00:00
0
0
0
pemerolehan data php?
From 1970-01-01 08:00:00
0
0
0
PHP 데이터 수집?
From 1970-01-01 08:00:00
0
0
0
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template