php显示指定目录下子目录的方法

yipeiwu_com6年前PHP代码库

本文实例讲述了php显示指定目录下子目录的方法。分享给大家供大家参考。具体实现方法如下:

<?php
echo "<h2>subdirs in dir</h2><ul>";
$basedir = basename( __FILE__ );
$dirtoscan = ($basedir . '/somedir/');
$albumlisting = scandir($dirtoscan);
foreach ($albumlisting as $item) {
  $dirinfo = pathinfo($item);
  print_r($dirinfo);
  if (is_dir("$item")) {
   echo "<li><a href='index.php?subdirs=$item'>$item</a></li>";
  }
}
?>

希望本文所述对大家的php程序设计有所帮助。

相关文章

使用php实现截取指定长度

PHP语言: 根据中文裁减字符串复制代码 代码如下:function cutstr($string,$length, $dot = ' ...') {  if (strlen(...

用php过滤危险html代码的函数

#用户发布的html,过滤危险代码  function uh($str)  {  $farr = array(  "...

PHP数组操作简单案例分析

PHP数组操作简单案例分析

本文实例讲述了PHP数组操作相关技巧。分享给大家供大家参考,具体如下: 这个是一道简单的PHP数组入门题 $Str = "as5454654%^$%^$7675dhasjkdhh12...

PHP+Oracle本地开发环境搭建方法详解

安装instant client 首先,是从https://www.oracle.com/technetwork/topics/linuxx86-64soft-092277.html下载...

PHP简单生成缩略图相册的方法

本文实例讲述了PHP简单生成缩略图相册的方法。分享给大家供大家参考。具体如下: <?php /* * written by mot * 根目录下自己新建image...