简体   繁体   English

Composer供应商目录的完整物理路径

[英]Full physical path of Composer vendor directory

Is there any way to get the full physical path of the Composer's vendor folder? 有什么方法可以获取Composer供应商文件夹的完整物理路径吗?

I have been searching internet for an hour but no luck. 我已经在互联网上搜索了一个小时,但没有运气。

Thanks 谢谢

Use getcwd() function. 使用getcwd()函数。 Here you can read also regarding this http://php.net/manual/en/function.getcwd.php 在这里您还可以阅读有关此内容的http://php.net/manual/zh/function.getcwd.php

you can write a class within the constant " __FILE__ ". 您可以在常量“ __FILE__ ”内编写一个类。 just like following: 就像下面这样:

class ComposerPath{
    static  function  get(){
         return dirname(__FILE__);
    }
}

then you load it by composer,and use 然后由作曲家加载并使用

CompoerPath::get();

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM