";
echo "\$_SERVER['PHP_SELF']: " . $_SERVER['PHP_SELF'] . "
";
echo "dirname(\$_SERVER['PHP_SELF']): " . dirname($_SERVER['PHP_SELF']) . "
";
echo "__DIR__: " . __DIR__ . "
";
echo "dirname(__DIR__): " . dirname(__DIR__) . "
";
echo "dirname(__DIR__, 1): " . dirname(__DIR__, 1) . "
";
echo "dirname(__DIR__, 2): " . dirname(__DIR__, 2) . "
";
echo "dirname(__DIR__, 3): " . dirname(__DIR__, 3) . "
";
echo "basename(dirname(__DIR__, 1)): " . basename(dirname(__DIR__, 1)) . "
";
echo "basename(dirname(__DIR__, 2)): " . basename(dirname(__DIR__, 2)) . "
";
echo "basename(dirname(__DIR__, 3)): " . basename(dirname(__DIR__, 3)) . "
";
echo "isset(\$_SERVER['HTTPS']): " . (isset($_SERVER['HTTPS']) ? "yes" : "no") . "
";
echo "\$_SERVER['HTTP_HOST']: " . $_SERVER['HTTP_HOST'] . "
";
echo "\$path: " . $path . "
";
echo "\$end: " . $end . "
";
echo "strstr(\$path, \$end, true): " . strstr($path, $end, true) . "
";
echo "\$base: " . $base . "
";
echo "";
?>
$path = dirname($_SERVER['PHP_SELF']);
$end = basename(dirname(__DIR__, 1));
$secure = isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on';
$protocol = $secure ? 'https://' : 'http://';
$base = $protocol . $_SERVER['HTTP_HOST'] . strstr($path, $end, true) . $end . '/';
?>