我记得尝试了这么多次,它工作,但由于某种原因,它现在不适合我。我正在使用本地的wamp服务器来测试它。这不是一个公共场所。它不包括由于某种原因位于“/includes/header.php”中的简单h1标签。PHP包含不工作?
我的index.php代码:
<html>
<head>
<title>Weekend Warrior Squad - Homepage</title>
<link href="styles/styles.css" rel="stylesheet">
</head>
<body>
<?php include("/includes/header.php"); ?>
</body>
</html>
我的header.php代码:
<header>
<h1>WWS - Weekend Warrior Squad</h1>
<p>
We are community based paintball team make the game of paintball
more enjoyable for ourselves and others.
</p>
</header>
所有建议/答案都非常赞赏。
'/ includes/header.php' - 如果你打算使用'/',那么使用完整的服务器路径'/var/user/you/public_html/includes/header.php'或根据位置使用相对路径,例如'includes/header.php'或'../ includes/header.php'。 – 2014-10-30 03:57:02
我用目录C:/wamp/www/wws/includes/header.php尝试将header.php包含到我的index.php中,但仍然没有运气。 – cscodismith 2014-10-30 04:14:47
你如何试图访问你的初始文件?你不是通过浏览器来执行'http:// localhost/www/file.php'吗?我也有Wamp,它工作得很好。如果你对任何配置文件进行了任何更改,请确保你重新启动所有服务。在打开'<?php'标签后立即在文件顶部添加错误报告 'error_reporting(E_ALL); ini_set('display_errors',1);'看看它是否产生任何东西。 – 2014-10-30 04:18:05