PHP包括没有出现

时间:2012-08-08 05:29:33

标签: php include server-side-includes

我有一个php include,路径为[root]/Edge-animations/splash/publish/web/splash.php,是我服务器上的有效路径。在我第一次尝试时,我得到一条错误,说路径无效;事实证明,我需要放置完整的服务器路径(沿/homepages/3/d426847376/htdocs/Edge-animations/splash/publish/web/splash.php行)。纠正链接后,我尝试重新加载页面;它没有显示错误,但它没有显示它应该包含的文件。我的PHP语法如下:

<?php include('/homepages/3/d426847376/htdocs/Edge-animations/splash/publish/web/splash.php'); ?>

并将我用于工作PHP包含的语法与另一页面上的语法相匹配。我做错了什么?



修改
包含的文件是Edge输出的HTML文件;我将扩展名从.html更改为.php。这是它的代码:

<!DOCTYPE html>

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Untitled</title>
<!--Adobe Edge Runtime-->
<meta http-equiv="X-UA-Compatible" content="chrome=IE8">
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/chrome-          frame/1/CFInstall.min.js"></script>
    <script type="text/javascript" charset="utf-8" src="splash-v1_edgePreload.js">    </script>
    <style>
    .edgeLoad-Splash { display:none; }
</style>
<!--Adobe Edge Runtime End-->

</head>
<body style="margin:0;padding:0;">
<div id="Stage" class="Splash">
</div>
</body>
</html>

我现在还在链接中添加了括号和分号;它仍然无效。

1 个答案:

答案 0 :(得分:0)

仅出于测试目的尝试

<?php
$path = '/homepages/3/..........';
ini_set('display_errors', true);
error_reporting(E_ALL);

echo 'path=',$path, "<br />\n";
if ( !file_exists($path) ) {
    die('no such file');
}
else {
    //include $path;
    echo '<p>opening file</p>';
    $fp = fopen($path, 'rb');
    if ( !$fp ) {
        die('open failed');
    }
    echo '<p>reading file</p>';
    $content = stream_get_contents($fp);
    if ( false===$content ) {
        die('read failed');
    }
    echo '<p>strlen(content)=',strlen($content), '<p>';
}
相关问题