V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
rxzxf1993
V2EX  ›  PHP

thinkphp5 提示 method not exist:think\db\Query->

  •  
  •   rxzxf1993 · May 31, 2017 · 9941 views
    This topic created in 3256 days ago, the information mentioned may be changed or developed.

    model 是这样写的

    <?php
    
    namespace lib\model;
    
    use lib\BaseModel;
    use lib\model\Provider;
    
    class ProviderCheck extends BaseModel
    {
        //
        public function provider()
        {
            return $this->hasOne('provider','id','userid','p','left');
        }
    }
    
    

    调用

     $condition = $this->buildProviderCheckConditon($searchData);
            $providerCheckModel = new ProviderCheck();
            $list  = $providerCheckModel
                ->alias('pc')
                ->provider()
                ->where($condition['condition'])
                ->limit($condition['perpage']*($condition['p']-1), $condition['perpage'])
                ->select();
    
    
    2 replies    2017-06-01 11:13:49 +08:00
    Spectre
        1
    Spectre  
       Jun 1, 2017
    ProviderCheck 改成 ProviderCheckModel ?
    Spectre
        2
    Spectre  
       Jun 1, 2017
    额 看错了 看成 model not exist 了
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   824 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 30ms · UTC 21:10 · PVG 05:10 · LAX 14:10 · JFK 17:10
    ♥ Do have faith in what you're doing.