随笔分类 - cakePHP
摘要:前言 cakephp 的单元测试参考http://book.cakephp.org/2.0/en/development/testing.html以下是CakeTestCase类的断言,也就是cakephp 定义的断言,实际使用中还可以使用CakeTestCase的父类PHPUnit_Framewo...
阅读全文
摘要:这个问题折腾一点时间,所以吸取教训,先上一个流程图1.安装pear1)在命令行中,进入php安装目录,运行:go-pear.bat(可能出现报错情况)2)下载go-phar.bat至php安装目录,运行:php go-pear.phar3)双击刚产生的PEAR_ENV.reg ,导入注册表4)此时p...
阅读全文
摘要:1、Yii中的widget可以使用一完全独立的mvc就算是在layout中还是可以获取到数据库的数据2、方法1、/app/View/Elements/widget.ctp$data = $this->requestAction('/controller/action/param1/etc');方法2、 function beforeFilter() { parent::beforeFilter(); $this->set( 'cool_variable', $this->YourMethodOrComponent->action($par
阅读全文
摘要:<?php $item = array(); $item['/DashBoardCO'] = array( 'parent' => '', 'text' => '控制面板', 'url' => '/DashBoardCO' ); $item['/dashboardco/merchants'] = array( 'parent' => '/DashBoardCO', 'text' =>
阅读全文
摘要:$comments = $this->requestAction('/comments/latest');foreach ($comments as $comment) { echo $comment['Comment']['title'];}echo $this->requestAction( array('controller' => 'articles', 'action' => 'featured'), array('return'))
阅读全文
摘要:原理:获取数据库资源句柄 -》curd 操作-》使用 rallback或者submit 提交或者回滚即可例子:$dataSource = $this->getDataSource();$dataSource->begin();// Perform some tasksif (/*all's well*/) { $dataSource->commit();} else { $dataSource->rollback();}
阅读全文
摘要:原理就是使用数据库的方法处理出来一个查询结果,然后使用一个别名、//比如select contanct(a,b) as ca , b 就是一个普通的属性,c可以理解为public $virtualFields = array( 'name' => 'CONCAT(User.first_name, " ", User.last_name)');配置的方法很简单,如上就是、
阅读全文

浙公网安备 33010602011771号