随笔分类 -  Yii

The popular PHP FrameWork.
摘要:原文详情参见 这里1、下载phpexcel,将压缩包中的classes复制到protected/extensions下并修改为PHPExcel。2、修改YII配置文件config/main.php[php]view plaincopy'import'=>array('application.exte... 阅读全文
posted @ 2015-06-11 20:17 Debm.Zhang 阅读(378) 评论(0) 推荐(0)
该文被密码保护。
posted @ 2015-04-30 09:53 Debm.Zhang 阅读(1) 评论(0) 推荐(0)
摘要:在看yii2的时候, 在main文件里看到了这样一段代码language ?>而我查看了php.ini里的配置, short_open_tag=Off, 是关闭的.于是查了 php.net 关于 short_open_tag 的说明, 其中有一句This directive also affecte... 阅读全文
posted @ 2015-01-07 11:03 Debm.Zhang 阅读(248) 评论(0) 推荐(0)
摘要:value I am heretype I am herecheckbox columns useage 阅读全文
posted @ 2014-10-23 11:01 Debm.Zhang 阅读(174) 评论(0) 推荐(0)
摘要:Yii::app()->clientScript->registerScriptFile(Yii::app()->baseUrl."/js/TableView.js");Yii::app()->clientScript->registerScriptFile(Yii::app()->baseUrl.... 阅读全文
posted @ 2014-10-14 10:38 Debm.Zhang 阅读(199) 评论(0) 推荐(0)
摘要:今天要使用yii验证码, 不过, 这个验证码是整站通用的, 也就是说, 有个表单的提交是使用ajax方式来提交, 整站, 不管在哪个地方, 都能点出来此窗口, 来提交信息关于yii验证码, framework/web/widgets/captcha/CCaptcha.php里,它源码里有这么一部分>... 阅读全文
posted @ 2014-09-19 18:35 Debm.Zhang 阅读(501) 评论(0) 推荐(0)
摘要:一直在使用yii进行开发, 也知道如何去使用, 也仅仅是知道怎么去用罢了, 终归是没研究过源码, 心里发虚, 今天遇到一个问题, 关于自动登陆的问题.要求就是, 修改登陆保存session天数为自定义1, 2, 3 ... 等天数, 然后, 把原有的session信息清理掉.前面一段好操作, 就是在... 阅读全文
posted @ 2014-09-16 15:52 Debm.Zhang 阅读(685) 评论(0) 推荐(0)
摘要:先说说 render 与 renderPartial, 各位看官, 先别走, 我没跑题, 这个问题如果需要解决, 关键就在 render 与 renderPartial 的区别.renderPartial()方法public stringrenderPartial(string $view, arr... 阅读全文
posted @ 2014-08-21 11:35 Debm.Zhang 阅读(721) 评论(0) 推荐(0)
摘要:redirect 这个方法是在 CController 里定义的先来看下官方介绍redirect()方法public voidredirect(mixed $url, boolean $terminate=true, integer $statusCode=302)$urlmixedthe URL ... 阅读全文
posted @ 2014-07-18 16:38 Debm.Zhang 阅读(255) 评论(0) 推荐(0)
摘要:array( 'header' => '返回的服务器信息', 'name' => 'return_server_info', 'value' => 'str_replace("^", "", $data->return_server... 阅读全文
posted @ 2014-06-26 13:10 Debm.Zhang 阅读(805) 评论(0) 推荐(0)
摘要:参考https://github.com/2amigos/yiiwheels/blob/master/widgets/datetimepicker/WhDateTimePicker.phppublic function registerClientScript(){/* publish assets... 阅读全文
posted @ 2014-05-24 17:02 Debm.Zhang 阅读(374) 评论(0) 推荐(0)
摘要:参考http://www.yiiwiki.com/post/8使用yii做的项目,编辑的时候,使用到的是自带的CButtonColumn , 现在需要在编辑的时候跳新页面,这时只需要这样做就可以了'buttonID' => array( 'label'=>'...', //按钮的文本标... 阅读全文
posted @ 2014-05-10 12:50 Debm.Zhang 阅读(357) 评论(0) 推荐(0)
摘要:默认配置的话,是不会出现这个错误的,应该是有人为修改了 yiic.php 这个文件,本来是 $config 载入的应该是 console.php ,人为修改后载入了 main.php 这个配置文件了检查下yiic.php 里的配置就可以了.P.S 太坑了... 阅读全文
posted @ 2014-04-28 12:16 Debm.Zhang 阅读(575) 评论(0) 推荐(0)
摘要:问的白一点就是Displaying 1-10 of 15 results 如何翻译如果搜索的话, 搜这个会出来很多内容yii cgridview template summary好了,其他不说了,说下如何解决,解决前,先看一段官方介绍http://www.yiiframework.com/doc/api/1.1/CBaseListView#summaryText-detail参考:http://www.yiiframework.com/forum/index.php/topic/45752-modify-cgridview-template-summary/打开慢的朋友,看下边我摘出来的就行了 阅读全文
posted @ 2014-01-20 16:12 Debm.Zhang 阅读(836) 评论(0) 推荐(0)
摘要:需求及效果图如下没什么说的,就是修改分页,修改了CLinks分页的样式上代码'. */ public $nextPageLabel; /** * @var string the text label for the previous page button. Defaults to '>'. */ public $lastPageLabel; /** * @var string the text shown before page buttons. Defaults to 'Go to page: '. */ public $header; /** 阅读全文
posted @ 2014-01-07 15:04 Debm.Zhang 阅读(968) 评论(0) 推荐(0)
摘要:需要查询某时间段的记录,但是数据库里只有一个时间记录,如果写sql的话,很快的,放到yii里一时竟然没办法...不过,最后还是解决了,使用了一个第三方的插件参考http://www.yiiframework.com/wiki/461/adding-a-date-range-search-for-cgridview-the-easy-way/按照说明写就可以的,只是有一点,分页的时候,会出错,目前还不知道是哪里造成的,不过不影响大局,先给他列几百条记录出来先看一个图吧,如果是需要的,往下看,如果不是需要的,就当路过捧个场~~我这里的具体代码如下,当然,是yii 生成的代码,我稍加改动,懒就一个字 阅读全文
posted @ 2014-01-07 14:43 Debm.Zhang 阅读(1015) 评论(0) 推荐(0)
摘要:环境 : 后台有新闻分类和新闻的文章,在分类下有文章存在的时候,不想用户删除分类代码controller public function actionDelete($id) { $data = Category::model()->findByPk($id); if(count($data->fk_news) > 0){//统计此分类下是否有文章,如果有,则不允许删除此分类 if(isset($_POST)){ // echo json_encode(1); echo getClient... 阅读全文
posted @ 2013-11-11 20:11 Debm.Zhang 阅读(410) 评论(0) 推荐(0)
摘要:默认显示的内容是没有链接的,现在想加链接,效果图如下代码位置就在columns数组里,直接上代码说明$this->widget('zii.widgets.grid.CGridView', array( 'id'=>'news-grid', 'dataProvider' => $data, 'filter' => $model, 'columns' => array( 'nid', // 'n_title', array( 'nam 阅读全文
posted @ 2013-11-04 20:20 Debm.Zhang 阅读(292) 评论(0) 推荐(0)
摘要:这个其实最简单在对应的model里找Search方法找到后,参见如下代码 public function search() { // @todo Please modify the following code to remove attributes that should not be searched. $criteria=new CDbCriteria; $criteria->compare('nid',$this->nid); $criteria->compare('cid',$this->cid); $criteria-> 阅读全文
posted @ 2013-11-03 17:31 Debm.Zhang 阅读(256) 评论(0) 推荐(0)
摘要:效果图参照http://www.yiiframework.com/doc/api/1.1/CGridColumn http://www.yiiframework.com/doc/api/1.1/CGridView http://www.yiiframework.com/forum/index.php/topic/30694-cgridview-filter-dropdown-from-array/(*)代码search(); $filter = Category::model()->findAll(); $this->widget('zii.widgets.grid.CGr 阅读全文
posted @ 2013-11-03 17:27 Debm.Zhang 阅读(733) 评论(0) 推荐(0)