且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何将第3方库添加到magento?

更新时间:2023-11-29 22:46:16

浏览网站根目录中的/lib文件夹.来自 Magento基本目录:

Look into /lib folder in your website root directory. From Magento Base Directories:

Magento的库文件夹位于 非基于模块的Magento代码存在. 这包括大量的 系统代码,使Magento能够 运行,以及第三 政党图书馆(包括Zend 框架).图书馆也是 Magento将搜索的最后一个代码池 尝试自动加载文件时.

Magento’s library folder is where non-module based Magento code lives. This include a large amount of the system code which allows Magento to run, as well as a number of third party libraries (including the Zend Framework). The library is also the last code pool Magento will search when attempting to autoload a file.

因此,换句话说,如果您的库支持zend文件命名约定-magento自动加载器将找到并加载库类.否则,您可以使用Mage :: getBaseDir(‘lib’)获取/lib目录的路径,并编写类似

So, in other words, if your library supports zend file naming convention - library classes will be found and loaded by magento autoloader. Otherwise you can get path of your /lib directory with Mage::getBaseDir(‘lib’) and write something like

require_once(Mage::getBaseDir('lib') . '/EZComponents/Base/src/base.php');