douzhenzu0247 2014-12-04 13:37
浏览 20

列表只有一些格式文件n文件夹和子目录php在Ubuntu服务器上

I need to list all files for example mp4 or avi in my folder /Files and relative subdirectories and after that insert into <a href={$filename}><\a> tag so I need a array i suppose. I tried with find command but I receive a string and not a Array so I've to split the string and this isn't practical.

Any suggestion?

  • 写回答

2条回答 默认 最新

  • duanmei4362 2014-12-04 13:47
    关注
    <?php
    $dir ="/Files";
    $files = scandir($dir);
    foreach($files as $file) {
        $fullname = "/Files/" . $file;
        echo '<a href='.$fullname.'>File</a>;  
    }
    

    This should work for you.

    评论

报告相同问题?

悬赏问题

  • ¥15 求解O-S方程的特征值问题给出边界层布拉休斯平行流的中性曲线
  • ¥15 谁有desed数据集呀
  • ¥20 手写数字识别运行c仿真时,程序报错错误代码sim211-100
  • ¥15 关于#hadoop#的问题
  • ¥15 (标签-Python|关键词-socket)
  • ¥15 keil里为什么main.c定义的函数在it.c调用不了
  • ¥50 切换TabTip键盘的输入法
  • ¥15 可否在不同线程中调用封装数据库操作的类
  • ¥15 微带串馈天线阵列每个阵元宽度计算
  • ¥15 keil的map文件中Image component sizes各项意思