+ 1

How to include an external html file in a php file.

My Project files are like , index.html Assets(Folder) Php(Folder)(This folder is under Assets folder) Under php Folder i have a php file in that i want to include the index.html I have tried the include method in php but it doesn't work. it shows errors like , failed to open stream: No such file or directory in C:\xampp\htdocs\out_pass. I also tried the ../ method to access the parent directory that is also not working

16th Jun 2023, 11:09 AM
Kabilan K
Kabilan K - avatar
3 Respuestas
+ 3
"No such file directory" means the url to the file is incorrect. This can be tricky when you don't know the root directory of where your site is being served. Try placing the file at the first level of where the php file is then include ("file.html") You can also use readfile readfile("file.html")
16th Jun 2023, 11:59 AM
RuntimeTerror
RuntimeTerror - avatar
+ 2
I think you should try this path: . /Assets/Php/index.html
16th Jun 2023, 6:12 PM
Jan
Jan - avatar
+ 2
Thank you both of you Runtime Terror Quantum it's working perfectly 💥
17th Jun 2023, 5:38 AM
Kabilan K
Kabilan K - avatar