yii 笔记】的更多相关文章

语句部分: yii1版本打印最后一条执行的SQL: $this->getDbConnection()->createCommand()->select()->from()->order()->text : yii2版本打印最后一条执行的SQL: $query = InsuranceOnlineZaSuccess::find(); echo $query->createCommand()->getRawSql(); 获取最后一条入库的ID:$id  = $th…
Yii的redirect方法在CControler与CHttpRequest之中都有被定义,CController中的redirect调用了CHttpRequest中的redirect方法.我们平常调用的是CControoler中的redirect方法 在framewok/web/CController中的定义 public function redirect($url,$terminate=true,$statusCode=302) { if(is_array($url)) { $route=…
Yii1.1: $_GET 可以表示为 Yii::app()->request->getQuery() $_POST 可以表示为 Yii::app()->request->post(); 控制器: 路由: 控制器 ID 是一种 'path/to/xyz' 的格式,对应相应的控制器类文件protected/controllers/path/to/XyzController.php, 其中的标志 xyz 应被替换为实际的名字 (例如 post 对应protected/controlle…
选择Yii 2.0版本框架的7个理由 http://blog.chedushi.com/archives/8988 刚接触Yii谈一下对Yii框架的看法和感受 http://bbs.csdn.net/topics/390807796 更多内容 百度:yii 前端 http://my.oschina.net/u/1472492/blog/221085 摘要 Yii框架学习笔记(二)将html前端模板整合到框架中 原文地址:http://www.ldsun.com/1309.html 上一节成功将Y…
Yii 学习笔记 W:YII是什么? Q:Yii 是一个基于组件的高性能 PHP 框架,用于快速开发大型 Web 应用.它使Web开发中的 可复用度最大化,可以显著提高你的Web应用开发速度.Yii 这个名字(读作易(Yee) 或 [ji:])代表 简单(easy), 高效(efficient) 和 可扩展(extensible). W:开发前配置 Q:   在php5的php.ini里进行修改 extension=php_pdo_mysql.dll extension=php_mysql.dl…
YII常见报错笔记 报错返回的代码如下: <pre>PHP Notice 'yii\base\ErrorException' with message 'Uninitialized string offset: 0' in /my/test/project/iot/vendor/yiisoft/yii2/base/Model.php:778 Stack trace: #0 /my/test/project/iot/vendor/yiisoft/yii2/base/Model.php(778):…
第一步:进入yii migrate 通过dos(我是win7系统,其他系统类似,就是进入字符界面)打开网站目录 phpStudy/WWW/local/ddc_dlss 输入 ./yii migrate 按回车,会有个判断是否打开migrate,输入y按回车 这时候,就可以创建自己的数据库创建或者修改任务了! 举例1: 删除files表的data字段 第一步:创建任务文件 $ ./yii migrate/create del_colum_data_in_files_table 按回车,yii会在c…
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…
Theme 类,即一个应用的主题,主要通过替换路径实现主题的应用,里边的方法为获取根路径和根链接,以及应用主题的方法: namespace yii\base; use Yii; use yii\helpers\FileHelper; /** * Theme represents an application theme. * Theme 类,即一个应用的主题 * * When [[View]] renders a view file, it will check the [[View::them…
Application 类中设置路径的方法和调用ServiceLocator(服务定位器)加载运行时的组件的方法注释: /** * Handles the specified request. * 处理指定的请求--抽象方法 * This method should return an instance of [[Response]] or its child class * which represents the handling result of the request. * 该方法应该…
Module类中获取子模块,注册子模块,实例化控制器,根据路由运行指定控制器方法的注释: /** * Retrieves the child module of the specified ID. * 取出指定模块的子模块 * This method supports retrieving both child modules and grand child modules. * 该方法支持检索子模块和子模块的子模块 * @param string $id module ID (case-sen…
Module类中的辅助功能方法: /** * Returns an ID that uniquely identifies this module among all modules within the current application. * 返回模块的唯一标识 * Note that if the module is an application, an empty string will be returned. * @return string the unique ID of t…
Module类,属性的注释和构造函数的注释: <?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; /** * Module is the base…
Yii2请求处理流程: 首先:项目路径/web/index.php (new yii\web\Application($config))->run();//根据配置文件创建App实例,先实例化yii\web\Application(),然后调用run()方法 该语句可分为两步: $application = new yii\web\Application($config);//实例化app $application->run();//调用run()方法 $config 为配置文件,通过 req…
学而不思则罔,思而不学则殆,适度的总结有利于学习效果的提升. 以前就是埋头看书很少动手所以学习效果不好. 学习yii的原因是自己基本功差,但是yii的学习本身也需要成本…
<?= $form->field($modelUser,'name') ?> <div class="form-group field-community-mobile required"> <label for="mobile">手机 </label> <div class="input-group"> <span class="input-group-addon…
View中的查找视图文件方法和渲染文件方法 /** * Finds the view file based on the given view name. * 通过view文件名查找view文件 * @param string $view the view name or the path alias of the view file. Please refer to [[render()]] * on how to specify this parameter. * @param string…
View.php,继承了component,用于渲染视图文件: namespace yii\base; use Yii; use yii\helpers\FileHelper; use yii\widgets\Block; use yii\widgets\ContentDecorator; use yii\widgets\FragmentCache; /** * View represents a view object in the MVC pattern. * * View provides…
Model类,集中整个应用的数据和业务逻辑—— /** * Generates a user friendly attribute label based on the give attribute name. * 生成一个对用户友好的属性标签,将属性名中的下划线.破折号.点替换为空格,并且每个单词的首字母大写 * This is done by replacing underscores, dashes and dots with blanks and * changing the first…
Model类,集中整个应用的数据和业务逻辑——验证 /** * Returns the attribute labels. * 返回属性的标签 * * Attribute labels are mainly used for display purpose. For example, given an attribute * `firstName`, we can declare a label `First Name` which is more user-friendly and can *…
Model类,集中整个应用的数据和业务逻辑——场景.属性和标签: /** * Returns a list of scenarios and the corresponding active attributes. * An active attribute is one that is subject to validation in the current scenario. * 返回所有场景及与之对应的 active 属性的列表 * active 属性是指在默认场景中验证的 * The r…
Model类,集中整个应用的数据和业务逻辑: namespace yii\base; use Yii; use ArrayAccess; use ArrayObject; use ArrayIterator; use ReflectionClass; use IteratorAggregate; use yii\helpers\Inflector; use yii\validators\RequiredValidator; use yii\validators\Validator; /** *…
Action类,控制器中方法的基类: namespace yii\base; use Yii; /** * Action is the base class for all controller action classes. * Action是所有控制器方法的基类 * Action provides a way to reuse action method code. An action method in an Action * class can be used in multiple c…