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 です! これは ISS のバグですか?

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 に答える