1

php include を使用して Web ページに記事をインクルードしようとしています... 私のファイル構造は次のようになります。

  1. /記事
    • /記事
      • App_Template.html
    • /タグ
      • /新着
        • index.html
    • /含む
      • File.html

App_Template.html には、次のコードがあります。

<?php include("../including/File.html"); ?>

これは正常に動作し、App_Template.html にアクセスすると正しい記事が表示されますが、コードは次のとおりです。

<?php include(".../including/File.html"); ?>

新しいフォルダー内の index.html 内では機能せず、次のエラーがスローされます。

Warning: include(.../including/File.html) [function.include]: failed to 
open stream: No such file or directory in 
/home/a1696768/public_html/articles/tags/new/index.html on line 79


Warning: include() [function.include]: Failed opening
 '.../including/File.html' for inclusion 
(include_path='.:/usr/lib/php:/usr/local/lib/php') 
in /home/a1696768/public_html/articles/tags/new/index.html on line 79

私はこれの理由を見つけるために周りを検索しようとしましたが、なぜこれがここで機能しないのかについての理由を見つけることができませんが、App_Template.html にあります。私が想像できる唯一のことは、 2 番目のケースは index.html ですか?

4

1 に答える 1

1

...パスに3 つのドットを使用することはできません..。1 つ上のレベルまたは.現在のレベルのいずれかです。2 つ上のフォルダー/レベルに移動する場合は、 を使用します../../yourfile

于 2012-12-08T19:36:51.000 に答える