【发布时间】:2019-12-08 17:17:21
【问题描述】:
树:
--myproject
----mailer
-------class.phpmailer.php
----test
-------index.php
----site.php
----class.php
----db.php
----index.php
index.php:(两者)
<?php
require_once '../site.php';
?>
site.php:
<?php
require_once "class.php";
?>
class.php
<?php
require_once 'db.php';
require_once('./mailer/class.phpmailer.php');
?>
当我访问测试时,它显示:
警告:require_once(./mailer/class.phpmailer.php):打开失败 流:C:\wamp\www\myproject\class.php 中没有这样的文件或目录 在第 3 行
致命错误:require_once(): 未能打开所需的 './mailer/class.phpmailer.php' (include_path='.;C:\php\pear') in C:\wamp\www\myproject\class.php 在第 3 行
我也试过include_once,但同样的错误!
【问题讨论】:
-
首先,如果site.php和index.php都在同一个目录下,你为什么要
require_once '../site.php';?
标签: php require-once include-once