【发布时间】:2012-08-08 05:29:33
【问题描述】:
我有一个 php 包含,路径指向 [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>
我现在还在链接中添加了括号和分号;还是不行。
【问题讨论】:
-
error_reporting你设置了什么级别? -
您可能在包含的文件中有问题。某些东西可能会中止脚本,更改 error_settings 以隐藏错误等。向我们展示这个包含文件的代码。
-
我认为你缺少一个“;”最后...语法应该是
-
我已经添加了“;”,现在服务器返回一个错误,指出在
/homepages/3/d426847376/htdocs/splash.php下找不到文件。出于某种原因,它似乎将 folder “splash”视为 PHP 文件。这是完整的错误记录:Warning: include(/homepages/3/d426847376/htdocs/splash/publish/web/splash-v1.php) [function.include]: failed to open stream: No such file or directory in /homepages/3/d426847376/htdocs/splash.php on line 163作为记录,我的文档的第 163 行包含包含代码。 -
@Verandaguy 检查文件是否存在 if(file_exists('pages/'.$page.'.php')) { include('pages/'.$page.'.php'); }
标签: php include server-side-includes