1 :获取控制器名
(1) 在控制器中获取控制器名字 $name = $this->getId();
(2)在视图中获取控制器名字 $name = Yii::app()->controll->id;
2 :获取动作名
(1)在控制器beforeAction()回调函数中获取动作名 $name = $action->id
(2)在model中获取方法名 $name = $this->scenario;
(3)在其他地方获取动作名 $name = $this->getAction()->getId();
3: 模板渲染顺序 main.php -->view.php -->column2.php
4 :想要更新记录,或者添加记录 一定要在User.php中 的search()函数中的参数写全,不能少字段
5 : 这个函数很好用的 $form->dropDownList($model,'city',City::items(CHtml::resolveValue($model,'city')));
6 :$GLOBALS 能讲所有的变量拿出来
7:<?php $form=$this->beginWidget('CActiveForm', array(
'id'=>'user-form',
'enableClientValidation'=>true, //这代表客户端验证的意思 还有两种 一种是服务器端验证 一种是ajax验证 回家再jQuery
'enableAjaxValidation'=>false, 开启了这个的话 会加载jQuery,否则不会