• 技术文章 >PHP >PHP框架

    php中CakePHP框架如何使用?

    十一十一2021-03-08 12:40:37原创5140

    作为主流的基于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));

    以上就是对于cakephp使用方式了,大家现在都应该清楚掌握了吧,好啦,感兴趣的小伙伴多多尝试下哦~

    推荐操作系统:windows7系统、PHP5.6、DELL G3电脑

    专题推荐:php
    品易云
    上一篇:php中PHPUnit框架如何使用? 下一篇:php如何实现把字符串转为数组?

    相关文章推荐

    • php中Phalcon框架如何使用?• php中PHPUnit框架如何使用?

    全部评论我要评论

    © 2021 Python学习网 苏ICP备2021003149号-1

  • 取消发布评论
  • 

    Python学习网