Home > Backend Development > PHP Tutorial > Simple browsing of directory contents in php_PHP tutorial

Simple browsing of directory contents in php_PHP tutorial

WBOY
Release: 2016-07-15 13:21:37
Original
910 people have browsed it

<?php
$dir = dirname(__FILE__);
$open_dir = opendir($dir);
echo "<table border=1 borderColor=red cellpadding=6>";
echo "<tr><th>文件名</th><th>大小</th><th>类型</th><th>修改日期</th></tr>";
while ($file = readdir($open_dir)) {
	if ($file!= "." && $file != "..") {
		echo "<tr><td>" . $file . "</td>";
		echo "<td>" . filesize($file) . "</td>";
		echo "<td>" . filetype($file) . "</td>";
		echo "<td>" . filemtime($file) . "</td></tr>";
	}

}
echo "</table>";
?>
Copy after login

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/477173.htmlTechArticle?php$dir = dirname(__FILE__);$open_dir = opendir($dir);echo table border=1 borderColor=red cellpadding=6;echo trth file name/thth size/thth type/thth modification date/th/tr;while ($fil...
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