I’ve got the code
$directory = "C:/My file path";
$phpfiles = glob($directory . "*.html");
foreach($phpfiles as $phpfiles)
{
echo $phpfiles;
}
But how would I change it so that it doesn’t just list the files, but actually links to them?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
First of all, don’t use same variable names at foreach(). You can link to files, like this.
$phpfilecontaining full path of file (for example : /home/eray/Desktop/test.html)basename()is returning just file name from path .basename($phpfile)‘s output istest.html. If you want to print justtest(without.htmlextension) , you can use this :basename($phpfile, ".html")Thanks, @aSeptik.