how to embed html files in php code?

后端 未结 4 1075
野性不改
野性不改 2020-12-03 14:46

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

4条回答
  •  野趣味
    野趣味 (楼主)
    2020-12-03 15:09

    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.

    
    

提交回复
热议问题