search

Home  >  Q&A  >  body text

Caching problem, the statement in else executes normally, but a screenshot error occurs in if($cache)? Ask God

public function train_surp(){
        $cache=Cache::get('train_surp');
        if($cache){
            $this->assign('list',unserialize($cache));
        }
        else{
            $retult=train::paginate(5);
            Cache::set('train_surp',$retult,10);
            $list=Cache::get('train_surp');
            $this->assign('list',$list);
        }
        return $this->fetch();
    }QQ截图20171110201309.png

王岁洋王岁洋2605 days ago1040

reply all(3)I'll reply

  • myfey

    myfey2017-11-27 14:12:28

    if($cache){$cache in

    should be the object type

    if (this is a Boolean value judgment that cannot determine the object type)



    reply
    0
  • PHP中文网

    PHP中文网2017-11-11 09:30:52

    I don’t see what you are asking specifically?

    reply
    0
  • Cancelreply