Jump to content

Include Files in Different Directories


hkothari

Recommended Posts

So, let's say I have a site setup like this

 

/index.php

/file.php

/file3.php

/dir/

/dir/file2.php

 

Now, I know if I needed to include file.php from index.php I would use:

include("file.php")

and if I wanted to include file2.php I would use:

include("dir/file2.php");

but what if I wanted to use file2.php from index.php and file2.php needed file3.php would I use

include("file3.php");

or

include("../file3.php");

because the file that is actually being executed is index.php?

Link to comment
https://forums.phpfreaks.com/topic/174898-include-files-in-different-directories/
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.