如何为目录中的所有文件创建超链接


How to create hyperlinks for all files in a directory?

我试图招募目录中的所有文件,我已经这样做了,但我想将这些文件名与它们的路径链接起来,但没有得到与你想要的相同的结果。

php

if(isset($_GET['alls'])){
        $session = $_GET['session'];
        $subject = $_GET['subject'];
        $dirh = $session.'/'.$subject.'/';
        if ($handle = opendir($dirh)) {
            while (false !== ($entry = readdir($handle))) {
                if ($entry != "." && $entry != "..") {
                    echo "<a href='$dirh.'/'.$entry'> $entry'n </a>";
                }
            }
            closedir($handle);
        }
    }
I think The problem may concatenation
Try like this
echo "<a href='".$dirh."/".$entry."'>".$entry."</a><br/>";