【发布时间】:2016-09-07 01:24:13
【问题描述】:
好的,我有一种情况,我在不同的目录中有多个文件,需要弄清楚如何将它们链接在一起。这是结构:
- /home/username/public_html/index.php
- /home/username/public_html/secure/index.php
- /home/username/public_html/elements/includes/db.php
- /home/username/config.ini
好的,所以在我的两个 index.php 文件中,我都包含引用 db.php:
index.php
<?php include("elements/includes/db.php"); ?>
和secure/index.php
<?php include("../elements/includes/db.php"); ?>
现在在 db.php 文件中,我有以下对 config.ini 的引用:
$config = parse_ini_file('../../../config.ini');
我知道它没有启动,因为它应该是相对于 index.php 而不是 db.php,但我将如何正确引用这些文件?我希望我的 config.ini 位于 public_html 目录之外。
【问题讨论】: