Adding 3rd party library to ZendFramework(将 3rd 方库添加到 ZendFramework)
问题描述
我的问题很简单:
如何添加 API 和/或第 3 方库到我的 ZendFramework以某种方式应用它可以在一个控制器
How do I add an API and/or 3rd party library to my ZendFramework application in a way which makes it possible to access it in a
controller
推荐答案
这是一篇详细介绍如何实现此目标的博客文章:http://blog.keppens.biz/2009/05/add-your-own-library-to-your-new-zend.html
Here is a blog post detailing how to achieve this: http://blog.keppens.biz/2009/05/add-your-own-library-to-your-new-zend.html
或者,如果您不想调整 application.ini 文件,您可以通过 Bootstrap 类来完成.将此函数添加到 Bootstrap:
Alternatively, if you don't want to tweak the application.ini file, you can do it through your Bootstrap class. Add this function to Bootstrap:
protected function _initAutoload() {
$loader = Zend_Loader_Autoloader::getInstance();
$loader->registerNamespace('MyCode_');
}
然后在library"文件夹中,添加一个名为MyCode"的文件夹.该文件夹应该与Zend"文件夹平行.当然,您应该更改MyCode"以反映您要添加的库的名称.
Then in the "library" folder, you would add a folder called "MyCode". This folder should be parallel to the "Zend" folder. Naturally you should change "MyCode" to reflect the name of the library you're adding.
我应该注意,通过使用上述方法,我假设代码使用 PEAR 命名方案(就像 ZF).
I should note that by using the above method, I'm assuming the code uses the PEAR naming scheme (just like ZF).
这篇关于将 3rd 方库添加到 ZendFramework的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:将 3rd 方库添加到 ZendFramework
![](/xwassets/images/pre.png)
![](/xwassets/images/next.png)
- PHP foreach() 与数组中的数组? 2022-01-01
- 如何使用 Google API 在团队云端硬盘中创建文件夹? 2022-01-01
- 如何在 Symfony2 中正确使用 webSockets 2021-01-01
- Oracle 即时客户端 DYLD_LIBRARY_PATH 错误 2022-01-01
- 使用 GD 和 libjpeg 支持编译 PHP 2022-01-01
- Laravel 5:Model.php 中的 MassAssignmentException 2021-01-01
- openssl_digest vs hash vs hash_hmac?盐与盐的区别HMAC? 2022-01-01
- 覆盖 Magento 社区模块控制器的问题 2022-01-01
- 如何从数据库中获取数据以在 laravel 中查看页面? 2022-01-01
- PHP - if 语句中的倒序 2021-01-01