YII
yuhui_fish
...
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
yii上传图片、yii上传文件、yii控件activeFileField使用
yii框架提供了activeFileField控件来完成上传文件(当然也包括了上传图片)的操作,下面介绍yii的activeFileField使用方法。 1、函数原型: public static string activeFileField(CModel $model, string $attribute, array $htmlOptions=array ( )) 2、调用例子:转载 2012-04-12 15:23:28 · 4650 阅读 · 0 评论 -
YII CJuiDialog 中运行ajax CGridView
1,CJuiDialog按钮 $('#choose-clientele').click(function(){ var client_url=baseUrl+'/index.php?r=basedata/clienteles'; $('#clientele_dialog').dialog("open"); $.ajax({url:client_url,async:false,s原创 2013-05-16 14:21:42 · 1473 阅读 · 0 评论 -
在Yii中使用Captcha验证码
在Yii中使用Captcha验证码: 详细代码请参考:yii自带的示例代码post 项目,里面有一个contact表单用到了验证码. 1,Model: 将验证码加入UserLogin的一个属性: class UserLogin extends CFormModel { public $username; public $password; public $rememberMe;原创 2012-05-18 16:36:52 · 15821 阅读 · 2 评论 -
YII 错误排除
属性 "Order.formula_id" 未被定义. 如果你的Model添加了规则,还出现属性未被定义的错误,试下清除YII缓存。 (清缓存:Yii::app()->cache->flush();)原创 2012-12-24 16:48:27 · 1587 阅读 · 0 评论 -
yii CActiveRecord 查询
find() // find the first row satisfying the specified condition $post=Post::model()->find($condition,$params); // find the row with postID=10 $post=Post::model()->find('postID=:postID', array(':pos转载 2012-12-07 16:33:09 · 8977 阅读 · 0 评论 -
yii 权限控制
摘录以3种: 1,通过accessControl, public function filters() { return array( 'accessControl', // perform access control for CRUD operations ); } /** * Specifies the access control rules. *原创 2012-11-16 17:12:55 · 2630 阅读 · 0 评论 -
Yii Criteria
Yii Criteria常用方法(select,join,where,日期,) $criteria = new CDbCriteria; //select $criteria->select = '*';//默认* $criteria->select = 'id,name';//指定的字段 $criteria->select = 't.*,t.id,t.name';//连接查询原创 2012-11-30 10:39:41 · 21514 阅读 · 1 评论 -
yii model 添加默认值
yii model 继承自CActiveRecord 有些字段可能不会出现在表单中,而需要在程序中加入。 如订单编号,时间戳,操作的user_id等等。 以下二种方法: 1,在rules()方法中设定: public function rules() { // NOTE: you should only define rules for those attributes that原创 2012-11-01 15:00:18 · 8479 阅读 · 0 评论 -
YII 网站收藏
http://www.eha.ee/labs/yiiplay/index.php/en YII playground 操场: 这里可以找到常用的组件的示例demo,和示例代码code http://yiibook.com/ YII 教程: 这里有二本在线电子书,原创 2012-09-12 14:18:18 · 757 阅读 · 0 评论 -
yii DropDown for pageSize in CGridView
A convenient drop down to select page size and save in User state. Step 1: On top of my controller action for the gridview (if you used CRUD, this isactionAdmin() ) i added: 1 //转载 2012-08-29 14:46:15 · 1320 阅读 · 0 评论 -
Yii 加载js,加载css,删除js,删除css,js文件管理,css文件管理
1,加载js $cs = Yii::app()->getClientScript(); $cs->registerCoreScript('jquery'); $cs->registerCssFile($baseUrl.'/css/redmond/jquery-ui.css'); $cs->registerCssFile($baseUrl.'/css/style.css'); $cs->r原创 2012-06-26 16:29:38 · 2681 阅读 · 0 评论 -
Yii 清理缓存
Yii 清理缓存: html: ClearCache js: function clearCache() { $.get('../eng/index.php?r=site/clear&'+new Date().getTime(),function(){ alert('Clear eng cache ok.'); }); } php: pu原创 2012-06-12 18:07:38 · 10642 阅读 · 0 评论 -
YII框架多子域名同步登录问题
YII的资料实在是太少了。为了让后来者减少摸索时间,我写下我的解决方法。 a.meylou.com和b.meylou.com不做登录。c.meylou.com这个专门做用户登录。c站登录之后a,b站点同时登录。 第一步:修改php.ini配置文件,把cookie_domain=改成“cookie_domain=meylou.com” 第二部:修改各个站点的c转载 2012-06-12 17:45:43 · 4033 阅读 · 2 评论 -
yii使用CUploadedFile上传文件的一般方法
一、前端代码 Html代码 createUrl('/upload/default/upload/');?>" method="post" enctype="multipart/form-data"> controller->currentDir?>"/> 二、后端代码 Php代码 public function actionUp转载 2012-04-20 15:01:40 · 16857 阅读 · 0 评论 -
YII优化 ActiveRecord schema
因为当运用模型(model)时,AR的一些公共属性都会从DB中获取,这样会导致服务器负担一些额外的资源开销,实际上对于成品来说,服务器这些开始销是多余的,故应该阻止这种默认行为 开启schema缓存: 'db'=>array( ... 'schemaCachingDuration'=>86400, // time in seconds ... ),翻译 2013-09-12 16:20:24 · 2311 阅读 · 0 评论
分享