【问题标题】:How to point to one directory up (../) in PHP? [duplicate]如何在PHP中指向一个目录(../)? [复制]
【发布时间】:2014-01-22 19:37:43
【问题描述】:

当我在这个文件上时:/here/here.php 我可以要求来自同一文件夹的文件:

require_once(__DIR__."/here2.php");

但是我不知道如何上一个目录来指向这样的东西:

/there/there.php

如何使用相对路径指向另一个文件?

【问题讨论】:

  • /../ 向上遍历目录

标签: php


【解决方案1】:
require_once __DIR__ . '/../there/there.php';

require_once dirname(__DIR__) . '/there/there.php';

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2011-08-11
    • 1970-01-01
    • 1970-01-01
    • 2011-11-04
    • 1970-01-01
    • 1970-01-01
    • 2017-07-12
    • 1970-01-01
    相关资源
    最近更新 更多