Jump to content

silly question...


mkosmosports

Recommended Posts

I want to use the include function on a file thats in the top-level directory of my site. I call on that from many sub-level directories, so whats the syntax to always call on that file, which is in the top-level directory?

 

Ive tried:

include ("../dbconnect.php");,

include ("/dbconnect.php");

 

Doesnt work... :P

Link to comment
https://forums.phpfreaks.com/topic/36923-silly-question/
Share on other sites

Yeah, that works. Thanks Ted Chou. I did have to enable URL file-access in the server configuration.

After reading up on php.net, turns out php doesnt handle including files from other directories very well. A user posted this question there:

 

"Why are the included files not looked up relative from the file that includes them and then in the include path? This would be a behavior like in all other languages."

Link to comment
https://forums.phpfreaks.com/topic/36923-silly-question/#findComment-176148
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.