我記得嘗試了這麼多次,它工作,但由於某種原因,它現在不適合我。我正在使用本地的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