“组件”之间的差异和“插件”在cakephp 2.1? [英] Difference between a "component" and a "plugin" in cakephp 2.1?

查看:128
本文介绍了“组件”之间的差异和“插件”在cakephp 2.1?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

cakephp中的插件和组件之间有什么区别?我有一些事情,我认为是组件 - 因为他们加载了

what is the difference between a "plugin" and a "component" in cakephp? I have some things that i thought were components - because they are loaded with the

var $components = array(...);

但现在我已经升级到cakephp 2.1事实,插件由无用的错误消息。

but now that i have upgraded to cakephp 2.1 (from 1.3) I am told that these are, in fact, "plugins" by the useless error message. Are components just another name for plugins... or something else?

推荐答案

组件和插件在Cake 2.0中仍然是单独的实体。 根据手册组件是是共享的逻辑包控制器,而插件是控制器,模型和视图的组合 。组件扩展了基本组件类,而插件有自己的AppModel和AppController。

Components and Plugins are still separate entities in Cake 2.0. According to the manual components are "are packages of logic that are shared between controllers", whereas plugins are "a combination of controllers, models, and views". Compoments extend the base Component class, while Plugins have their own AppModel and AppController.

想想一个插件作为一个单独的Cake应用程序与您的主应用程序共享相同的核心库。

Think of a plugin as a separate Cake application sharing the same core libraries with your main application.

此外,在Cake 2.0中组件与1.3的处理略有不同(它们应该在文件名中包含组件,因此 SessionComponent.php code> session.php ),并删除了一些函数。 EmailComponent 已完全弃用。

Also, in Cake 2.0 components are handled slightly different from 1.3 (they should have component in their file name, so SessionComponent.php instead of session.php, for example) and some functions were removed. The EmailComponent was deprecated entirely, for example.

您收到的错误讯息可能指第三方组件。哪些是给你麻烦?

The error messages you're getting might refer to third-party components. Which ones are giving you trouble?

这篇关于“组件”之间的差异和“插件”在cakephp 2.1?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆