How to include PHP file in HTML file? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

How to include PHP file in HTML file?

It's possible to include some functions from PHP file to HTML file like CSS or JS files and how server read functions if I have two PHP files just in case for learning!

16th Oct 2016, 10:02 PM
Alireza Nazari
Alireza Nazari - avatar
4 Answers
+ 2
By default, the server will only process files that end with .php, so You must create a .php file, put your HTML inside it, then include any php you'd like.
16th Oct 2016, 10:44 PM
Yassine Rajjaf
Yassine Rajjaf - avatar
+ 5
Thanks again that was useful information 😊
12th Dec 2017, 1:55 PM
Alireza Nazari
Alireza Nazari - avatar
+ 3
<?php include("yourFile.php"); ?>
18th Oct 2016, 1:47 AM
Feliphe Allef
Feliphe Allef - avatar
+ 2
<?php include 'YourFileLocation' ; ?>
17th Oct 2016, 9:52 PM
Mujahith ilahi
Mujahith ilahi - avatar