米粒人生

米粒人生

代码如诗

  • 财富值6555
  • 威望值230
  • 总积分9325

个人信息

  • 回复了 的评论

    没看明白为什么写这么多
    例:轮播图模型
    Focus.php
    Focus 中 type=0 PC端,type=1 手机端

    FocusQuery.php 中添加方法

    //改自andWhere方法
    public function pc(){
            if ($this->where === null) {
                $this->where = ['type'=>0];
            } elseif (is_array($this->where) && isset($this->where[0]) && strcasecmp($this->where[0], 'and') === 0) {
                $this->where[] = ['type'=>0];
            } else {
                $this->where = ['and', $this->where,['type'=>0]];
            }
            return $this;
        }
    

    Focus.php 添加方法

     public static function pc(){
      return self::find()->pc();
     }
    

    同样能实现

    Focus::find()->pc()->all();
    Focus::pc()->all();
    

    你没有重载 __staticCall(),Focus::pc()->all() 这一步会报错。另外,你的那么多 if()..esle()... 不大好

  • 回复了 的说说
    前后端分离是大势所趋,对各种视图模板都 不感兴趣....
    与其花时间研究各种模板,不如好好的学学vue这些前端技能。前后端分离是大势所趋。
  • 2018-07-25 已签到
    连续签到6天,获得了20个金钱
  • 发表了说说
    前后端分离是大势所趋,对各种视图模板都 不感兴趣....
  • 2018-07-24 已签到
    连续签到5天,获得了20个金钱
  • 2018-07-23 已签到
    连续签到4天,获得了20个金钱
  • 2018-07-22 已签到
    连续签到3天,获得了15个金钱
副总裁 等级规则
9325/10000
资料完整度
90/100
用户活跃度
0/100

Ta的关注

16

Ta的粉丝

111

Ta的访客

183