I would include a php header ( mysite.com/header.php
) in all the pages from a site.
How to do it properly?
There are relative links:
<?php include_once 'header.php'; ?>
<?php include_once '../header.php'; ?>
And this didn't help:
<?php include_once '/header.php'; ?>
你可以这样做:
include($_SERVER["DOCUMENT_ROOT"] . "/header.php");
Try
<?php require_once('./header.php'); ?>
And adjust the path as needed, ie ../header
.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.