php简单浏览目录内容的实现代码

yipeiwu_com6年前PHP代码库

如下所示:

复制代码 代码如下:

<?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>";
?>

相关文章

PHP中file_exists()判断中文文件名无效的解决方法

本文实例讲述了PHP中file_exists()判断中文文件名无效的解决方法。分享给大家供大家参考。具体方法如下: php中判断文件是否存在我们会使用file_exists函数或is_f...

PHP文件上传类实例详解

本文实例讲述了PHP文件上传类。分享给大家供大家参考,具体如下: 这里演示了FileUpload.class.php文件上传类,其中用到了两个常量,可在网站配置文件中定义: defi...

php版微信公众号接口实现发红包的方法

php版微信公众号接口实现发红包的方法

本文实例讲述了php版微信公众号接口实现发红包的方法。分享给大家供大家参考,具体如下: 最近接到一个任务,需要用微信来给用户自动发红包。要完成这个任务需要这么已经一些物料 微信商户号,已...

PHP面向对象继承用法详解(优化与减少代码重复)

本文实例讲述了PHP面向对象继承用法。分享给大家供大家参考,具体如下: 继承 先看两个类 <?php class CdProduct { public $playL...

浅谈php提交form表单

处理GET请求 实现的功能是输入姓名后页面显示“Hello XXX” 创建html文件hello.html: <!DOCTYPE html> <html>...