无法在我的代码中包含使用require或include的Css文件


Cannot include my Css files using require or include in my code

我的网站出现了一些异常问题。我已经在我的头文件中插入了所有的CSS文件,并将其包含在每个php页面中。下面是一个php头文件,我将它包含在每个php页面中。然而,标题的内容出现了,但样式根本没有出现。我已经检查了Cs和include文件的路径,但仍然找不到问题。

让我给你下面的路径细节,也许你可以发现问题,如果我没有。标头位于includes文件夹中,现在我要做的是从admin文件夹中的admincontent.php调用标头。

标头中包含的css文件:localhost/bobs/css/files。。。。

标题路径:localhost/bobs/includes/Header.php

调用Header的文件:localhost/bobs/admin/admincontent.php

<?php require_once("function.php")?>
<!DOCTYPE html>
<html leng ="en">
<head>
<meta charset="utf-8" /> 
<title>ClickTravelStay</title>
 <link href="css/reset.css" rel="stylesheet" type="text/css">
 <link href="css/general.css" rel="stylesheet" type="text/css">
 <link href="css/footer.css" rel="stylesheet" type="text/css">
 <link href="css/form.css" rel="stylesheet" type="text/css">
 <link href="css/admin.css" rel="stylesheet" type="text/css">
 <link href='http://fonts.googleapis.com/css?family=Droid+Sans' rel='stylesheet' type='text/css'>
 <link href='http://fonts.googleapis.com/css?family=Oswald:400,700' rel='stylesheet' type='text/css'>
</head>
<body>
<div id="topHeader" class="Calign"> 
    <a href ="index.php" id="logoFigure">
    <img src="img/repetimg/logo.png" height="60"/ >
    </a>   
    <div class="cBoth"><!-- clear Both--></div>    
    <ul id="nav">
    <li><a href="index.php">HOME</a></li>
    <li><a href="vication.php">VICATION</a></li>
    <li><a href="carrental.php">CAR RENTAL</a></li>
    <li><a href="#">Corporate</a></li>
    <li><a href="deals.php">DEALS</a></li>
    <li><a href="contact.php">CONTACT</a></li>
    <li><a href="about.php">ABOUT US</a></li>
    </ul>
    <ul id="help">
    <li><a href="#">Book online or call: 080099999 Free from a landline</a></li>
    </ul>
</div><!-- END OF topHeader-->

下面的代码是admincontent.php的代码,它调用头文件。

<?php require_once("../includes/header.php");?>
<?php require_once("../includes/connection.php");?>
<?php find_hotel_and_room_forNavig();?>
<div class="cBoth"></div>
<div id="sep"></div>
<div id="content" class="Calign">
<ul id="menu">
             <?php
               Navigation($selected_hot, $selected_rom);
             ?>
             <li><a href="new_hotel.php">+ Add new Hotel >></a></li>
</ul>
<div id="subcontent">
<?php
     echo $selected_hot['hotel_name']."</p>"; 
     echo $selected_rom['room_type']."</p>";
?>
</div><!--end of subcontent-->
</div><!--end of content-->
</body>
</html>

我不明白的是,当我从index.php调用头时,说的是admin文件夹像这样(localhost/bobs/index.php)一切都很好,但我不能引用admin文件夹中的头。这是一个错误吗?因为从我看来,除非有其他需要设置的东西,否则路径是好的。请记住,我可以访问标题的内容,但样式根本不显示。html像往常一样出现,但没有任何样式。非常感谢您的支持。

我不明白的是,当我从index.php调用头时,说像这样的管理文件夹(localhost/bobs/index.php)一切都很好,但我不能引用管理文件夹中的头。

这是按设计工作的:您使用的是相对路径。请改用CSS样式表的绝对路径。

使用绝对路径

/bobs/css/[filename].css