yii源码一 -- CComponent】的更多相关文章

CComponent: path:framework/base/CComponent.php overview:This file contains the foundation classes for component-based and event-driven programming.              (包含基于组件和事件驱动编程的基础类,是所有components的基类) 1.property定义 $a=$component->text; // equivalent to $…
今天开始阅读yii2的源码,想深入了解一下yii框架的工作原理,同时学习一下优秀的编码规范和风格.在此记录一下阅读中的小心得. 每个框架都有一个入口文件,首先从入口文件开始,yii2的入口文件位于web目录的index.php,用于启动web应用和配置一些路径参数. index.php—— // comment out the following two lines when deployed to production defined('YII_DEBUG') or define('YII_D…
Container,用于动态地创建.注入依赖单元,映射依赖关系等功能,减少了许多代码量,降低代码耦合程度,提高项目的可维护性. namespace yii\di; use ReflectionClass; use Yii; use yii\base\Component; use yii\base\InvalidConfigException; use yii\helpers\ArrayHelper; /** * Container implements a [dependency injecti…
Instance类, 表示依赖注入容器或服务定位器中对某一个对象的引用 namespace yii\di; use Yii; use yii\base\InvalidConfigException; /** * Instance represents a reference to a named object in a dependency injection (DI) container or a service locator. * Instance 表示依赖注入容器或服务定位器中对某一个对…
ServiceLocator,服务定位类,用于yii2中的依赖注入,通过以ID为索引的方式缓存服务或则组件的实例来定位服务或者组件: namespace yii\di; use Yii; use Closure; use yii\base\Component; use yii\base\InvalidConfigException; /** * ServiceLocator implements a [service locator](http://en.wikipedia.org/wiki/S…
web/Application类的注释,继承base/Application类,针对web应用的一些处理: namespace yii\web; use Yii; use yii\base\InvalidRouteException; /** * Application is the base class for all web application classes. * Application 是所有web应用的基类 * * @property string $homeUrl The hom…
Widget类中开始,获取视图对象,获取widget ID,渲染视图,获取路径方法注释: private $_id; /** * Returns the ID of the widget. * 返回插件的ID * @param boolean $autoGenerate whether to generate an ID if it is not set previously * @return string ID of the widget. */ public function getId(…
Widget类是所有小部件的基类,开始,结束和渲染小部件内容的方法的注释: namespace yii\base; use Yii; use ReflectionClass; /** * Widget is the base class for widgets. * Widget是所有小部件的基类 * * @property string $id ID of the widget. * @property \yii\web\View $view The view object that can…
动态模型DynamicModel类,用于实现模型内数据验证: namespace yii\base; use yii\validators\Validator; /** * DynamicModel is a model class primarily used to support ad hoc data validation. * DynamicModel是一种主要用于支持ad hoc数据验证模型类 * * The typical usage of DynamicModel is as fo…
Yii/web中的Controller类,实现参数绑定,启动csrf验证功能,重定向页面功能: namespace yii\web; use Yii; use yii\base\InlineAction; use yii\helpers\Url; /** * Controller is the base class of web controllers. * * @author Qiang Xue <qiang.xue@gmail.com> * @since 2.0 */ class Cont…