laravel5.8 源码分析(1) Route

前端之家收集整理的这篇文章主要介绍了laravel5.8 源码分析(1) Route前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

源码路径 vendor\laravel\framework\src\Illuminate\Routing\Router.PHP

搜索 public function   #各种方法不说了
https://learnku.com/docs/laravel/5.8/routing/3890 官方文档

  

 源码路径 vendor\laravel\framework\src\Illuminate\Routing\Router.PHP

protected $allowedAttributes = [
        ‘as‘,‘domain‘,‘middleware‘,‘name‘,‘namespace‘,‘prefix‘,‘where‘,];


//以上方法属性调用
public function __call($method,$parameters){    if (in_array($method,$this->passthru)) {        return $this->registerRoute($method,...$parameters);    }    if (in_array($method,$this->allowedAttributes)) {        if ($method === ‘middleware‘) {            return $this->attribute($method,is_array($parameters[0]) ? $parameters[0] : $parameters);        }        return $this->attribute($method,$parameters[0]);    }    throw new BadMethodCallException(sprintf(        ‘Method %s::%s does not exist.‘,static::class,$method    ));}

猜你在找的Laravel相关文章