作为主流的基于MVC架构的php框架,cakephp可谓非常耀眼了,不仅是第一个进入市场的框架,也是现在最好用的框架之一,随着时间的不停流逝,性能也不断的提升
1、$uses来声明
public $uses = array("Question", "Answer");
2、转换成对象
public $actsAs = array('Bean');
3、cakephp 查询
$conditions = array(); $conditions['or'] = array( array('BuddyRelationship.user_id'=>$userId, 'BuddyRelationship.buddy_user_id'=>$buddyUserId), array('BuddyRelationship.user_id'=>$buddyUserId, 'BuddyRelationship.buddy_user_id'=>$userId) ); $conditions['and'] = array('BuddyRelationship.status'=>self::Accepted, 'BuddyRelationship.deleted'=>self::Undeleted); $buddyCount = $this->find('count', compact('conditions'));
4、输出内容
$creditModel = ClassRegistry::init("Credit"); $conditions['and'] = array('Credit.amount <>'=>0); $conditions['and'] = array("User.id" => $uid); $credit = $creditModel->find('first', array('conditions'=>$conditions));
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:mmqy2019@163.com进行举报,并提供相关证据,查实之后,将立刻删除涉嫌侵权内容。
长按识别二维码并关注微信
更方便到期提醒、手机管理