随笔分类 - YiiFreamework
摘要:今天工作的时候遇到一个问题,一个模块的数据表只存了一个时间字段 add_time ,但是搜索是区间的。这个时候就可以用我的办法来解决了。这个问题比较常见,故而整理下来。 操作时间 ~ start_...
阅读全文
摘要:label($model,'remark'); ?>: textArea($model,'remark',array('class'=>'', 'rows'=>3,'cols'=>80)); ?> 都是调用model中的东西,的确很厉害
阅读全文
摘要:yii模版中的判断方法,isNewRecord):?>label($model,'order_sn'); ?>:order_sn?>不用解释了,看看就明白。
阅读全文
摘要:$route=$this->getAction()->id
阅读全文
摘要:为什么用YII assets1.assets的作用是方便模块化,插件化的,一般来说出于安全原因不允许通过url访问protected下面的文件,但是我们又希望将module单独出来,所以需要使用发布,即将一个目录下的文件复制一份到assets下面方便通过url访问$assets = Yii::get...
阅读全文
摘要:在模版中dropDownList($model, 'src_type_id', OrderSrc::options(), array( 'id' => 'task-order-src-id', )); echo $form->dropDownList($model, 'src_shop_id', ...
阅读全文
摘要:getViewFile('_admin/_grid_view')?>这样在模版中,调用其他的模版文件。
阅读全文
摘要:二登录验证yii提供了CUserIdentity类,这个类一般用于验证用户名和密码的类.继承后我们需要重写其中的authenticate()方法来实现我们自己的验证方法.具体代码如下:class UserIdentity extends CUserIdentity{private $_id;publ...
阅读全文
摘要:一、查询数据集合1、$admin=Admin::model()->findAll($condition,$params);该方法是根据一个条件查询一个集合,如: findAll("username=:name",array(":name"=>$username));2、$admin=Admin::m...
阅读全文
摘要:在html中给文字加链接的方式为:href="createUrl('/shipping/Task/create')?>"
阅读全文
摘要:转载地址:http://blog.sina.com.cn/s/blog_664c9f650100wkmp.html1,在SiteController action()下:return array( // captcha action renders the CAPTCHA im...
阅读全文
摘要:原文地址:http://blog.sina.com.cn/s/blog_664c9f650100yqkn.html设置cookie:$cookie=newCHttpCookie('mycookie','this is my cookie');$cookie->expire=time()+60*60*...
阅读全文
摘要:在 Yii框架中使用session 的笔记:首先,在Yii框架中,你不需要像标准PHP代码那样使用session_start(),在Yii框架中,autoStart属性缺省被设置为true,所以,虽然没有使用session_start(),你仍然可以使用$_SESSION全局变量,但最好使用Yii框...
阅读全文
摘要:array( array('username', 'required'), array('username', 'length', 'min'=>3, 'max'=>12), array('password', 'compare', 'compareAttribute'=>'password2', ...
阅读全文
摘要:form表单Views中:dropDownList($model,'cate_id',Category::model()->getCategoryList()); ?>Models中:public function getCategoryList(){$returnArr = $this->find...
阅读全文