开发者

PHP - include index.php for path above this one [closed]

开发者 https://www.devze.com 2023-03-31 10:37 出处:网络
This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time,or an extraordinarily narrow situation that is not generally applic
This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center. Closed 11 years ago.

So, am using this code here...

<?php

if (file_exists(dirname(dirname(__FILE__)) . '/index.php'))
    include(dirname(dirname(__FILE__)) . '/index.php');
else
    exit;

?>

So I have a filepath like so:

/root/folder/a_sub1/b_sub1/c_sub1/d_sub1

Each *_sub folder has a file index.php with the above code in it. The folder directory has the following code in its index.php file.

<?php

// Look for Settings.php....
if (file_exists(dirname(dirname(__FILE__)) . '/Settings.php'))
{
    // Found it!
    require(dirname(dirname(__FILE__)) . '/Settings.php');
    header('Location: ' . $boardurl);
}
// Can't find it... just forget it.
else
    exit;

?>

The root folder has Settings.php within it that defines the $boardurl to be: http://dptest.dream-portal.net, so why is it NOT redirecting to the $boardurl when I type in the url like this?

http://dptest.dream-portal.net/folder/a_sub1

To my understanding, it should include each index.php file within each path above it, until it gets to folder and than it should call upon Settings.php within the root and this should than just load up the $boardurl (http://dptest.dream-portal.net) in开发者_C百科stead right? Makes sense to me, but instead I am getting a 500 Internal Server Error when browsing any subdirectories within the folder directory...

Can someone please help me here.

Cheers :)

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号