【发布时间】:2016-08-15 15:50:11
【问题描述】:
我收到以下错误:
警告:require_once(D:/xampp/htdocs/inc/head.php):打开失败 流:中没有这样的文件或目录 D:\xampp\htdocs\ecommerce1\index.php 在第 3 行
致命错误:require_once():需要打开失败 'D:/xampp/htdocs/inc/head.php' (include_path='.;D:\xampp\php\PEAR') 在 D:\xampp\htdocs\ecommerce1\index.php 在第 3 行
我有以下代码:位于D:\xampp\htdocs\ecommerce1 Index.php
<!--head-->
<?php $title="Gamer"?>
<?php require_once $_SERVER["DOCUMENT_ROOT"]. '/inc/head.php';?>
<?php require_once $_SERVER["DOCUMENT_ROOT"]. '/inc/menu.php';?>
<!--body of the page-->
<!--footer of the page-->
<?php require_once $_SERVER["DOCUMENT_ROOT"]. '/inc/footer.php';?>
`
这是位于D:\xampp\htdocs\ecommerce1\inc的head.php
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title><?php print $title ?> </title>
<link rel="stylesheet" type="text/css" href="/css/style.css">
<script type="text/javascript" src="/jquery/jquery-1.12.3.min.js"></script>
</head>
<body>
【问题讨论】:
-
对不起,我对 php 有点陌生——我应该把这段代码粘贴到那里,因为它什么都不做
-
其实你需要要么
<?php require_once $_SERVER["DOCUMENT_ROOT"]. 'ecommerce1/inc/head.php';?> and so on for others要么<?php require_once 'inc/head.php';?> and so on for others
标签: php pear fatal-error require-once