您的位置:首页 > 编程语言 > PHP开发

Yii框架官方指南系列34——扩展Yii:使用扩展

2014-11-07 00:00 731 查看
适用扩展通常半酣了以下三步:
从 Yii 的 扩展库 下载扩展.
解压到 应用程序的基目录 的子目录 extensions/xyz 下,这里的 xyz 是扩展的名称.
导入, 配置和使用扩展.

每个扩展都有一个所有扩展中唯一的名称标识.把一个扩展命名为 xyz ,我们也可以使用路径别名定位到包含了 xyz 所有文件的基目录.

不同的扩展有着不同的导入,配置,使用要求.以下是我们通常会用到扩展的场景,按照他们在 概述 中的描述分类.

1. Zii 扩展

Before we start describing the usage of third-party extensions, we would like to introduce the Zii extension library, which is a set of extensions developed by the Yii developer team and included in every release since Yii version 1.1.0. The Zii library is hosted as a Google project called zii.

When using a Zii extension, one must refer to the corresponding class using a path alias in the form of zii.path.to.ClassName. Here the root alias zii is predefined by Yii. It refers to the root directory of the Zii library. For example, to use CGridView, we would use the following code in a view script when referring to the extension:
$this->widget('zii.widgets.grid.CGridView', array(
    'dataProvider'=>$dataProvider,
));
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: