September 1st, 2002, 03:32 AM
Include Files In PHP?
Hello my nerdy amegos ,
Is there a method of putting include files in PHP. For example, in ASP they do it like this :: <!- #include file="thepage.asp" ->.
Any help would be appriciated.
September 1st, 2002, 03:37 AM
yes its a function called include()
so u just at the top of the page usually put
hope it helps rioter
September 1st, 2002, 03:41 AM
Thanks RiOtEr, i'm just checking now....
September 1st, 2002, 06:24 AM
does the file have to have an extention of '.inc'?
September 1st, 2002, 06:42 AM
No, you can have any extension you want, .inc is just a good idea to keep yourself organized. You may also want to use the require() fuction, which for something can work better and can be more suited to your needs than include() can.
September 1st, 2002, 11:58 AM
You can also use require_once('file.inc');
September 1st, 2002, 12:56 PM
Hmm, does this execute all code in that file, or does it just make functions and variables available?
I wish to express my gratitude to the people of Italy. Thank you for inventing pizza.
September 1st, 2002, 01:10 PM
guus include makes them avalible require runs it least thats my understanding of it
September 1st, 2002, 11:39 PM
They both do the same thing, but the difference is that include will include whatever you want in the page and if there is an error it will continue loading the page. However require will stop the page from loading if there is an error. As for require and include once, they are usually used for files that you want to make sure aren't loaded multiple times, it is also helpful because it can keep you from making a mistake. Hope dis helps.
September 2nd, 2002, 01:04 AM
If you need to see any errors form the include use
at the top of the page....