yii2源码学习笔记(十八)】的更多相关文章

Module类是模块和应用类的基类. yiisoft\yii2\base\Module.php <?php /** * @link http://www.yiiframework.com/ * @copyright Copyright (c) 2008 Yii Software LLC * @license http://www.yiiframework.com/license/ */ namespace yii\base; use Yii; use yii\di\ServiceLocator;…
view剩余代码 /** * @return string|boolean the view file currently being rendered. False if no view file is being rendered. * 当前正在渲染的视图文件 */ public function getViewFile() { return end($this->_viewFiles); } /** * This method is invoked right before [[rende…
继续了解controller基类. /** * Runs a request specified in terms of a route.在路径中指定的请求. * The route can be either an ID of an action within this controller or a complete route consisting * of module IDs, controller ID and action ID. If the route starts with…
继续了解Application. /** * Registers the errorHandler component as a PHP error handler. * 注册errorHandler组件作为PHP错误处理函数 * @param array $config application config 应用程序配置 */ protected function registerErrorHandler(&$config) { if (YII_ENABLE_ERROR_HANDLER) {/…
Module类的最后代码 /** * Registers sub-modules in the current module. * 注册子模块到当前模块 * Each sub-module should be specified as a name-value pair, where * name refers to the ID of the module and value the module or a configuration * array that can be used to c…
这几天有点忙今天好些了,继续上次的module来吧 /** * Returns the directory that contains the controller classes according to [[controllerNamespace]]. *根据控制器的命名空间返回控制器的目录路径 * Note that in order for this method to return a value, you must define * an alias for the root nam…
Action是所有控制器的基类,接下来了解一下它的源码.yii2\base\Action.php <?php /** * @link http://www.yiiframework.com/ * @copyright Copyright (c) 2008 Yii Software LLC * @license http://www.yiiframework.com/license/ */ namespace yii\base; use Yii; /** * Action is the base…
Application是所有应用程序类的基类,接下来了解一下它的源码.yii2\base\Application.php. <?php /** * @link http://www.yiiframework.com/ * @copyright Copyright (c) 2008 Yii Software LLC * @license http://www.yiiframework.com/license/ */ namespace yii\base; use Yii; /** * Applic…
Action 的概述 InlineAction 就是内联动作,所谓的内联动作就是放到controller 里面的 actionXXX 这种 Action.customAction 就是独立动作,就是直接继承 Action 并实现 run 方法的 Action. 与 Controller 的交互 public function createAction($id) { if ($id === '') { $id = $this->defaultAction; } $actionMap = $this…
转:http://blog.csdn.net/huwenfeng_2011/article/details/43458213 IOS离线推送 场景: 如果您有iOS端的APP,在会话聊天的时候,用户登陆了但可能会退出了界面.这时候其他终端给目标端发送消息时候,消息可以发送到ios的推送服务器.用过QQ的都知道,你会有哦一条消息在您的主屏上展示.这个就是利用了IOS的推送服务器呢.那么openfire只需要判断用户不在线的时候将消息推送给IOS端. 苹果服务器的消息推送都需要手机的唯一标志,也就是…
View继承了component,用于渲染视图文件:yii2\base\View.php <?php /** * @link http://www.yiiframework.com/ * @copyright Copyright (c) 2008 Yii Software LLC * @license http://www.yiiframework.com/license/ */ namespace yii\base; use Yii; use yii\helpers\FileHelper; u…
Widget类是所有部件的基类.yii2\base\Widget.php <?php /** * @link http://www.yiiframework.com/ * @copyright Copyright (c) 2008 Yii Software LLC * @license http://www.yiiframework.com/license/ */ namespace yii\base; use Yii; use ReflectionClass; /** * Widget is…
Theme 类,应用的主题,通过替换路径实现主题的应用,方法为获取根路径和根链接:yii2\base\Theme.php <?php /** * @link http://www.yiiframework.com/ * @copyright Copyright (c) 2008 Yii Software LLC * @license http://www.yiiframework.com/license/ */ namespace yii\base; use Yii; use yii\helpe…
模型类DynamicModel主要用于实现模型内的数据验证yii2\base\DynamicModel.php <?php /** * @link http://www.yiiframework.com/ * @copyright Copyright (c) 2008 Yii Software LLC * @license http://www.yiiframework.com/license/ */ namespace yii\base; use yii\validators\Validato…
Controller控制器类,是所有控制器的基类,用于调用模型和布局. <?php /** * @link http://www.yiiframework.com/ * @copyright Copyright (c) 2008 Yii Software LLC * @license http://www.yiiframework.com/license/ */ namespace yii\base; use Yii; /** * Controller is the base class for…
Behvaior类,Behavior类是所有事件类的基类: 目录yii2\base\Behavior.php <?php /** * @link http://www.yiiframework.com/ * @copyright Copyright (c) 2008 Yii Software LLC * @license http://www.yiiframework.com/license/ */ namespace yii\base; /** * Behavior is the base c…
Event是所有事件类的基类.它封装了与事件相关的参数. yii2\base\Event.php <?php /** * @link http://www.yiiframework.com/ * @copyright Copyright (c) 2008 Yii Software LLC * @license http://www.yiiframework.com/license/ */ namespace yii\base; /** * Event is the base class for…
assets   前端资源文件夹,用于管理css js等前端资源文件等 commands   包含命令行命令,文件为控制器文件 config 应用的配置文件 controllers 控制器文件 mail  (应用的前后台和命令行的与邮件相关的布局文件等) modles 模型文件 runtime 程序运行时生成的临时文件 tests     用于各种测试程序的测试类文件 vendor  就是各种第三方的程序. 这是Composer安装的其他程序的存放目录,包含Yii框架本身. 如果你向compos…
今天继续了解model类 /** 2 * Returns the form name that this model class should use. 3 * 4 * 返回表单的名称,就是这个 model 的类名 5 * 6 * The form name is mainly used by [[\yii\widgets\ActiveForm]] to determine how to name 7 * the input fields for the attributes in a mode…
继续了解组件Component.php /** * Returns a value indicating whether a property is defined for this component. * A property is defined if: * * - the class has a getter or setter method associated with the specified name * (in this case, property name is case…
组件(component),是Yii框架的基类,实现了属性.事件.行为三类功能,如果需要事件和行为的功能,需要继承该类. yii\base\Component代码详解 <?php /** * @link http://www.yiiframework.com/ * @copyright Copyright (c) 2008 Yii Software LLC * @license http://www.yiiframework.com/license/ */ namespace yii\base;…
yii\base\Object代码详解 <?php /** * @link http://www.yiiframework.com/ * @copyright Copyright (c) 2008 Yii Software LLC * @license http://www.yiiframework.com/license/ */ namespace yii\base; use Yii; /** * Object is the base class that implements the *pr…
类图关系 属性与方法 class Component extends BaseObject { private $_events = []; private $_eventWildcards = []; private $_behaviors; public function __get($name) public function __set($name, $value) public function __isset($name) public function __unset($name)…
关系类图 从上图可以看出 Application 类继承了 Module,在框架中的是非常重要角色. 加载配置 public function setModules($modules) { foreach ($modules as $id => $module) { $this->_modules[$id] = $module; } } base\Module 通过 setModules 把 Module 配置信息加载进来,赋值给 私有变量 _modules. 解析路由 Module 还有一个…
上接 Underscore.js 源码学习笔记(上) === 756 行开始 函数部分. var executeBound = function(sourceFunc, boundFunc, context, callingContext, args) { if (!(callingContext instanceof boundFunc)) return sourceFunc.apply(context, args); var self = baseCreate(sourceFunc.prot…
版本 Underscore.js 1.9.1 一共 1693 行.注释我就删了,太长了… 整体是一个 (function() {...}());  这样的东西,我们应该知道这是一个 IIFE(立即执行函数). var root = typeof self == 'object' && self.self === self && self || typeof global == 'object' && global.global === global &…
python3.4学习笔记(十八) pycharm 安装使用.注册码.显示行号和字体大小等常用设置Download JetBrains Python IDE :: PyCharmhttp://www.jetbrains.com/pycharm/download/ PyCharm首页.文档和下载 - Python集成开发环境 - 开源中国社区http://www.oschina.net/p/pycharm=============================================修改…
AXI_LITE源码学习笔记 1. axi_awready信号的产生 准备接收写地址信号 // Implement axi_awready generation // axi_awready is asserted for one S_AXI_ACLK clock cycle when both // S_AXI_AWVALID and S_AXI_WVALID are asserted. axi_awready is // de-asserted when reset is low. alwa…
Hadoop源码学习笔记(6) ——从ls命令一路解剖 Hadoop几个模块的程序我们大致有了点了解,现在我们得细看一下这个程序是如何处理命令的. 我们就从原头开始,然后一步步追查. 我们先选中ls命令,这是一个列出分面式文件系统中的目录结构.传入一个查阅地址,如果没有则是根目录.启动NameNode和DataNode服务.然后在命令行中输入ls : 换成程序,如果写呢,我们新建一个ClientEnter类.之前章节中,我们就知道,在命令行中输入的dfs命令,指向到org.apache.hado…
Hadoop源码学习笔记(5) ——回顾DataNode和NameNode的类结构 之前我们简要的看过了DataNode的main函数以及整个类的大至,现在结合前面我们研究的线程和RPC,则可以进一步看看几个对象的大至结构以及调用关系. 我们知道,三个结构(客户端,NameNode,DataNode)是能过网络调用的,走的是RPC.那在底层通讯时谁做服务器谁做客户端呢?我们先回顾一下这三者关系: 这样看,看不出,我们进入源码,看一下夹在中间的NameNode: 在这个initialize函数中,…