zoukankan      html  css  js  c++  java
  • thinkphp6-6

    ThinkRoutedispatchcontroller->init()  绑定控制器和方法

    public function init(App $app) { parent::init($app); $result = $this->dispatch; if (is_string($result)) { $result = explode('/', $result); } // 获取控制器名 $controller = strip_tags($result[0] ?: $this->rule->config('default_controller')); if (strpos($controller, '.')) { $pos = strrpos($controller, '.'); $this->controller = substr($controller, 0, $pos) . '.' . Str::studly(substr($controller, $pos + 1)); } else { $this->controller = Str::studly($controller); } // 获取操作名 $this->actionName = strip_tags($result[1] ?: $this->rule->config('default_action')); // 设置当前请求的控制器、操作 $this->request ->setController($this->controller) ->setAction($this->actionName); }

    13、接下来流程就是回到第5步

    最终会返回一个Response对象。流程又回到了第2步过程

    14、然后会在入口文件中

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    namespace think;
    //引入composer
    require __DIR__ . '/../vendor/autoload.php';
    $http = (new App())->http;
    $response $http->run();
    //执行返回的Response对象中的send方法
    //执行response对象中的send类方法  该方法是处理并输出http状态码以及页面内容
    $response->send();
    //执行Http对象中的send方法
    $http->end($response);
    //最终输出到页面上我
  • 相关阅读:
    发布镜像
    实战Tomcat镜像
    Docker File介绍
    数据卷容器
    DockerFile
    具名、匿名、指定路径挂载
    实战MySQL
    SHELL 常用技巧
    CentOS6和7启动流程
    解决服务器openssh漏洞
  • 原文地址:https://www.cnblogs.com/huaobin/p/14910229.html
Copyright © 2011-2022 走看看