Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

php includes in html files-directories

Do all php include files have to be in an include directory, or is that just an organizational convenience? Can I include files from any directory using the path to that directory? Do html files that contain php includes have to have a php extension? If so, I guess that would mean all of my html docs would be php if they all have the menus I am planning to "include". Is that acceptable protocol to have every file on your site be a php file?

A bow in humble reverence...

p.s. is there a good bible on this topic!?

like image 221
James Musser Avatar asked Mar 10 '26 06:03

James Musser


1 Answers

You don't need to have your php includes anywhere particular, or have any file extension...

Calling include('/path/to/your/file/with/any/extension.extension'); should include it as a php file

Normally safer to call files with php code in with a php extension tho.

like image 91
Mark Milford Avatar answered Mar 11 '26 19:03

Mark Milford



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!