php -/../或 "/../"在文件系统中意味着什么?

标签 php laravel directory filesystems

我知道。指当前目录,./指当前目录中的文件。 我还知道 .. 指的是父目录

最近我遇到了以下行:

require __DIR__.'/../vendor/autoload.php';

(它位于 laravel 的 index.php 文件中。)

这里“/../”具体是什么意思?

谢谢

编辑:我尝试在谷歌上搜索。我也尝试使用转义序列进行搜索,例如//..//,但它没有给出所需的答案。

最佳答案

你是这样读的:

__DIR__      // start in the current directory
../          // go up one directory from where you are
vendor/      // go into the vendor directory
autoload.php // and require the autoload.php file

__DIR__../ 之间额外的 / 只是为了确保当前目录以斜杠结尾,所以你得到,实例 code/../vendor/autoload.php 而不是 code../vendor/autoload.php

关于php -/../或 "/../"在文件系统中意味着什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50077460/

相关文章:

python - os.path.getsize 返回不正确的值?

php - Symfony 从路由中删除前三个字符

php - 如何在安装了 php 的 IIS 上检查单个站点的传出 HTTP 请求?

php exec 与 phing 的内存使用情况

php - Laravel view.php 在 base_path 中使用 config::get 变量

php - Laravel 播种输出

php - 在 Web 开发中使用 SVN

laravel - 从 Eloquent 关系中选择特定列

java - 如何访问系统公共(public)目录

安卓工作室 : Inserting files into the Assets folder