繁体   English   中英

PHP包含不显示

[英]PHP include not showing up

我有一个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>

现在,我还在链接中添加了括号和分号。 它仍然不起作用。

仅出于测试目的,请尝试

<?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>';
}

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM