I have many html files and now i want to call each of the files one by one using some php code. but whenever i try to run the php code for calling those html files from the
Small improvement to the accepted answer: you should prefer readfile() over include()
or require()
for non-PHP files. This is because include()
and require()
will be processed as PHP code, so if they contain something that looks like PHP (like ), they may generate errors. Or worse yet, a security vulnerability. (There is still potential security vulnerability if you are displaying user-provided HTML too, of course, but they at least won't be able to run code on your server.)
If the .html
files actually contain PHP code, you should name them appropriately.