大家来讨论Ci2.0的Packages
Packages应该是一个比较重要的改变了。本来我以为packages是ci用来解决hmvc做的改进,但是仔细看过之后,packages并不能实现,最起码不能直接实现HMVC。
1.因为Packages文件夹下面没有Controller/Views。
2.Packages不能用URL来激活。
3.不同的报包之间不能相互调用。
我现在只知道Packages是用来更好的区分文件夹。
手册上的解释:
Application "Packages"
An application package allows for the easy distribution of complete sets of resources in a single directory, complete with its own libraries, models, helpers, config, and language files. It is recommended that these packages be placed in the application/third_party folder. Below is a sample map of an package directory。
例如:
$this->load->add_package_path(APPPATH.'third_party/foo_bar/');
$this->load->library('foo_bar');
这样当Loader第一次找application下面的library文件夹失败的时候,就会再去找third_party/foo_bar/下面的foo_bar类库。 回复 1# navy92f
官方项目EE2.0中对Packages的介绍
Packages
ExpressionEngine 2.0 introduces packages for third-party add-ons, enabling all assets to be managed and updated much more simply, and making it easier to create complex add-ons with many components. 这个功能实际上是用来取代1.7.X版本中那个鸡肋的plugins的。 感觉和Java包机制差不多。
只不过
$this->load->add_package_path
类似于Java的 import package
页:
[1]