这是Laravel中Auth\Guard的构造函数:/***Createanewauthenticationguard.**@param\Illuminate\Auth\UserProviderInterface$provider*@param\Illuminate\Session\Store$session*@param\Symfony\Component\HttpFoundation\Request$request*@returnvoid*/publicfunction__construct(UserProviderInterface$provider,SessionStore$session,Request$request=null){$this->session=$session;$this->request=$request;$this->provider=$provider;}其中传入了参数SessionStore$session但是session的构造函数是这样的:publicfunction__construct($name,SessionHandlerInterface$handler,$id=null){$this->setId($id);$this->name=$name;$this->handler=$handler;$this->metaBag=newMetadataBag;}这里是有参数的,为什么Guard的构造函数可以自动生成session?是php原生提供的还是Laravel提供的?
慕无忌1623718
相关分类