0
Let’s say I have a file called header.php located in CMS/admin/includes. Let’s say I gave include this header.php file in a file called index.php located in CMS/admin.
Inside the header.php file I want to give include in a file called functions.php that is in CMS/admin (the same directory as index.php). I should use:
<?php include "../functions.php" ?>
or just
<?php include "functions.php" ?>
because header.php is being included in a file (index.php) that is found in the same functions.php directory (CMS/admin), I should give include as if functions.php were in the same header.php directory?
I could tell?
If Voce used index.php, the other includes, the index location must be referenced. Do you understand? type if the file that is the main one and will receive the other files, it will become only one. Then it must be refocused from the same location
– LocalHost
Depending on the case it is best to take a fixed starting point and concatenate, such as the
$_SERVER['DOCUMENT_ROOT'] . 'restodocaminho'
if you have too much depth variation. Or, set up the PHP includes path for a default folder. http://php.net/manual/en/ini.core.php#ini.include-path . Ideally it pays to organize in a way that does not depend on any of this..– Bacco