包括带子文件夹的标题

时间:2016-10-22 08:39:45

标签: php

我有一些大问题,包括我在子文件夹中的标题。我有一个像这样的文件夹结构:

[![文件夹结构] [1]] [1]

我想将我的标题包含在innovatian-project.php中。在我看来,我必须返回三个文件夹才能找到根目录:

  

AU - >课程 - > 文档根目录

我尝试了以下内容:

  • <?php include '../../../resources/includes/header.php'?>
  • <?php include(__DIR__.'/resources/includes/header.php'); ?>
  • <?php include($_SERVER['DOCUMENT_ROOT'].'/header.php'); ?>
  • <?php include($_SERVER['DOCUMENT_ROOT'].'/resources/includes/header.php'); ?>
  • <?php include('../../resources/includes/header.php'); ?>

但这一切都没有效果。我已经尝试了很多东西,我甚至不记得了。有人知道我能做什么吗?创新项目的道路在这里:

<?php include 'resources/includes/header.php' ?>

<body id="services">

<?php include 'resources/includes/navbar.php' ?>

<!-- start intro section -->
<section class="intro">
    <div class="container">
        <div class="row">

            <div class="col-md-12 text-center">
                <div class="intro-content">
                    <h1>Mine kompetencer  <strong>strongest </strong></h1>
                    <h2>areas, where I can add the most value to a company </h2>

                    Mine kompetencer er baseret på 
                </div>
            </div>
        </div>
    </div>
</section>
<!-- end intro section -->

更新

当我使用以下代码时,会调用页眉,导航和页脚。但是没有调用CSS:

<?php include $_SERVER['DOCUMENT_ROOT'] . '/Portfolio_da/resources/includes/header.php' ?>

<body id="services">

<?php include $_SERVER['DOCUMENT_ROOT'] . '/Portfolio_da/resources/includes/navbar.php' ?>

<!-- start intro section -->
<section class="intro">
    <div class="container">
        <div class="row">

            <div class="col-md-12 text-center">
                <div class="intro-content">
                    <h1>Mine kompetencer  <strong>strongest </strong></h1>
                    <h2>areas, where I can add the most value to a company </h2>

                    Mine kompetencer er baseret på 
                </div>
            </div>
        </div>
    </div>
</section>
<!-- end intro section -->

<?php include $_SERVER['DOCUMENT_ROOT'] . '/Portfolio_da/resources/includes/footer.php' ?>

更新2我在CSS中调用header.php

<!DOCTYPE HTML>
<html lang="en">
<head>



<!-- Favicon -->
<link rel="shortcut icon" href="images/favicon.ico">



<!-- Stylesheets -->
<link rel="stylesheet" href="css/bootstrap.min.css">
<link rel="stylesheet" href="css/font-awesome.css">
<link rel="stylesheet" href="css/owl.theme.css">
<link rel="stylesheet" href="css/owl.carousel.css">
<link rel="stylesheet" href="css/supersized.css">
<link rel="stylesheet" href="css/nivo-theme.css">
<link rel="stylesheet" href="css/nivo-lightbox.css">

<!-- Main Stylsheets -->
<link rel="stylesheet" href="css/style.css">
<link rel="stylesheet" href="css/responsive.css">
<!-- Theme Color Stylesheet -->
<link rel="stylesheet" href="css/theme_color.css">

<!-- Google Font -->
<link href='http://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,600,700' rel='stylesheet' type='text/css'>

<!--[if lt IE 9]>
    <script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
    <script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
<![endif]-->
<?php include_once("analyticstracking.php") ?>

</head>

1 个答案:

答案 0 :(得分:1)

  1. <?php include($_SERVER['DOCUMENT_ROOT'].'/resources/includes/header.php'); ?>

  2. 请参阅您的php.ini

  3.   

    allow_url_include

    1. 路由器文件中包含哪些内容?

    2. 你必须上2个文件夹。

      <?php include('../../resources/includes/header.php'); ?>

    3. 更新

      更改header.php中的这些行:<link rel="stylesheet" href="css/bootstrap.min.css">

      喜欢<link rel="stylesheet" href="http://<?php echo $_SERVER['HTTP_HOST'] ?>/Portfolio_da/css/bootstrap.min.css">