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);
    //最终输出到页面上我
  • 相关阅读:
    mysql查询两个日期之前相隔的天数
    数据库脏读、不可重读读、幻读
    kafka手动开启监听
    oracle更具uuid排序后进行分页
    idea右键没有svn选项
    alibaba dubbo admin的安装
    简单的可以跑起来的dubbo例子
    tomcat配置内存
    redis介绍和安装
    Python深入:Distutils发布Python模块
  • 原文地址:https://www.cnblogs.com/huaobin/p/14910229.html
Copyright © 2011-2022 走看看