0

ここに、php の include タグを含むウェルカム ページがあります。

ようこそ.php

 <html>
    <head>
        <title> Web Application</title>

        <link rel="stylesheet" type="text/css" href="extjs/resources/css/ext-all.css">

        <link rel="stylesheet" type="text/css" href="css/welcome_stylesheet.css">

        <script type="text/javascript" src="extjs/ext-debug.js"></script>

        <script type="text/javascript" src="welcome.js"></script>
    </head>
    <body id="welcome">
        <div id="container">
            <p id="welcome_page_h1">Welcome</p>
                <div id="select_container">
                    <?php include("stuff.php"); ?>
                </div>
        </div>


    </body>
    </html>

そして、これが私がインクルード/表示しようとしているphpファイルです。

スタッフ.php:

<p> Well how y'all doin? </p>
<p> Well how y'all doin? </p>
<p> Well how y'all doin? </p>
<p> Well how y'all doin? </p>

ここですべてのアヒルが順調に進んでいるように感じますが、何も表示されません。何か案は?

4

6 に答える 6

0

スペルと、 welcome.phpと同じディレクトリにあるindex.phpを確認してください。

問題がなければ、次の簡単なコードを使用して確認できます。

<?php
    echo ((include "index.php") == "OK") ? "OK" : "FAILED";
?>

または、このコードを使用してください

<?php
function get_file_content($filename) {
    if (is_file($filename)) {
        ob_start();
        include $filename;
        return ob_get_clean();
    } else {
        ob_clean();
        trigger_error("The file {$filename} was not found");
    }
}

echo get_file_content("index.php");
?>
于 2013-08-07T04:31:16.203 に答える
0

index.phpというページがあり、そのページ内で次のコードを使用しています...

<?php include 'header.html'; ?>

header.htmlはindex.phpと同じディレクトリにあります

于 2013-08-07T00:06:41.417 に答える
0

含めるファイルのファイル拡張子を .php 以外に変更すると、機能します。


つまり、welcome.php

//   . . . 
 <div id="select_container">
      <?php include("stuff.txt"); ?>
 </div>

スタッフ.txt

<p> Well how y'all doin? </p>
<p> Well how y'all doin? </p>
<p> Well how y'all doin? </p>
于 2013-08-07T00:07:32.823 に答える
0

括弧なしで試してください。

<?php include "stuff.php"; ?>
于 2013-08-06T23:59:49.067 に答える