0

我有以下目录文件结构;

/index.php
/head.inc    (upper)
/subdir/page.php
/subdir/head.inc   (lower)

在 /subdir/page.php 我有一个重定向到上层 index.php

header("location: ../index.php");

在 index.php 文件中有 include('head.inc') 指令。

在 Apache 服务器上加载了正确的 head.inc(上)——head.inc 来自 index.php 所在的同一(webroot)目录。在 IIS 上,加载了不正确的 head.inc(下部) - 来自 page.php 所在的 /subdir/ 的 head.inc 进行了重定向!这是国际空间站的错误吗?

4

1 回答 1

1

尝试生成自己的完整路径。这方面的例子可能是:

// Get the parent directory
$parent_directory = basename(dirname(dirname(__FILE__)));

header("Location: $parent_directory/index.php");
于 2012-08-10T23:21:00.327 回答