我是 php 的初学者,试图制作一个 main.php 文件,其中包含页眉和页脚作为开始
头文件.php
<html>
<body>
<div class="header">
logo, navigation etc
</div>
页脚.php
<div class="footer">
Footer content here
</div>
</body>
</html>
和主文件
<?php include "header.php"; ?>
<div class="main content">
<h1> header </h1>
<p> paragraph </p>
</div>
<?php include "footer.php"; ?>
错误:
Warning: include(header.php): failed to open stream: No such file or directory in - on line 1
Warning: include(): Failed opening 'header.php' for inclusion (include_path='.:') in - on line 1
Warning: include(footer.php): failed to open stream: No such file or directory in - on line 6
Warning: include(): Failed opening 'footer.php' for inclusion (include_path='.:') in - on line 6
所有文件都在同一个文件夹中,并在 XAMPP 上进行