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
基础教程推荐
- 如何在 Laravel 中使用 React Router? 2022-01-01
- 在PHP中根据W3C规范Unicode 2022-01-01
- PHP PDO MySQL 查询 LIKE ->多个关键词 2021-01-01
- Cron Jobs 调用带有变量的 PHP 脚本 2022-01-01
- 如何替换eregi() 2022-01-01
- 有什么方法可以用编码 UTF-8 而不是 Unicode 返回 PHP`json_encode`? 2021-01-01
- PHP 类:全局变量作为类中的属性 2021-01-01
- 学说 dbal querybuilder 作为准备好的语句 2022-01-01
- YouTube API v3 点赞视频,但计数器不增加 2022-01-01
- 如何在 Laravel 5.3 注册中添加动态下拉列表列? 2021-01-01
