我知道。指当前目录,./指当前目录中的文件。 我还知道 .. 指的是父目录
最近我遇到了以下行:
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/