<?php foreach (glob("*.html") as $filename) { echo ""$filename\n"."<br>"; } ?> My page displays a list of html files in the directory, how to make these files be links, and not just names?
"; } ?> My page displays a list of html files in the dir...">
<?php foreach (glob("*.html") as $filename) { echo ""$filename\n"."<br>"; } ?> My page displays a list of html files in the directory, how to make these files be links, and not just names?
To display links you need to use the <a> tag
foreach (glob("*.html") as $filename) { echo "<a href='$filename' >Имя файла</a><br>"; } And of course, in this case, in $filename you should have a valid path to your file on the server.
Read more here.
Source: https://ru.stackoverflow.com/questions/595700/
All Articles