1 Star 0 Fork 2

liyanping / magento

forked from alen / magento 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
magento2获取路径操作.txt 1.96 KB
一键复制 编辑 原始数据 按行查看 历史
alen 提交于 2020-09-10 12:09 . magento2获取路径操作
https://bbs.aiweline.com/thread-21231.htm
magento2获取路径操作
1、目录类: Magento\Framework\App\Filesystem\DirectoryList
2. 实例化目录类:
$_objectManager = \Magento\Framework\App\ObjectManager::getInstance();
$this->directory_list = $_objectManager->get('\Magento\Framework\App\Filesystem\DirectoryList');
读取目录类各种参数
//根目录
$this->directory_list->getRoot();
/*获取应用程序文件夹*/
$this->directory_list->getPath('app');
/*获取配置文件夹*/
$this->directory_list->getPath('etc');
/*获取库或第三方组件文件夹*/
$this->directory_list->getPath('lib_internal');
/*获取需要通过Web服务器文件夹公开访问的库/组件*/
$this->directory_list->getPath('lib_web');
/*获取公用文件夹*/
$this->directory_list->getPath('pub');
/*获取静态文件夹*/
$this->directory_list->getPath('static');
/*获取var文件夹*/
$this->directory_list->getPath('var');
/*获取文件系统缓存目录(如果使用文件系统缓存)*/
$this->directory_list->getPath('cache');
/*获取系统消息和错误的日志*/
$this->directory_list->getPath('log');
/*获取文件系统会话目录(如果使用了文件系统会话存储)*/
$this->directory_list->getPath('session');
/*获取安装程序应用程序的目录*/
$this->directory_list->getPath('setup');
/*获取与依赖项注入相关的文件目录*/
$this->directory_list->getPath('di');
/*生成代码的相对目录键*/
$this->directory_list->getPath('generation');
$this->directory_list->getPath('upload');
/*如果Composer由Magento Application运行,则存储与Composer相关的文件(配置,缓存等)的 目录*/
$this->directory_list->getPath('composer_home');
/*临时实现目录的后缀,将在其中写入预处理的文件(如有必要)*/
$this->directory_list->getPath('view_preprocessed');
/*获取模板缩小目录*/
$this->directory_list->getPath('html');
1
https://gitee.com/swallowli66/magento.git
git@gitee.com:swallowli66/magento.git
swallowli66
magento
magento
master

搜索帮助