福州網站建設>網站新聞>thinkphp6專區

        tp6入口文件如何綁定控制器

        發布日期:2022-03-16瀏覽次數:751 來源:福州網站建設

        // [ 應用入口文件 ]
        namespace think;

        require __DIR__ . '/vendor/autoload.php';

        // 執行HTTP應用并響應
        $http = (new App())->http;
        $response = $http->name('user')->path('register')->run();
        $response->send();


        這樣寫還是訪問的user下的index

        以上是由福州網站建設的小編為你分享了"tp6入口文件如何綁定控制器"文章,如果你在這方面有什么問題,隨時聯系我們

        網友評論

        • lgcoper 03月16日

          剛剛也要這樣用,研究了一下,設置路由規則即可,代碼如下。

          [code]
          <?php
          namespace think;
          require __DIR__ . '/../vendor/autoload.php';
          $app = new App();
          $app->route->rule('','modulename/controllername/actionname');
          $response = $app->http->name('modulename')->run();
          $response->send();
          $app->http->end($response);

          /****
          例如下面的寫法
          $app->route->rule('','member/user/register');
          $response = $app->http->name('member')->run();
          $response->send();
          $app->http->end($response);
          ***/
          [/code]

        • 好計謀 2020年10月12日

          多應用的咋搞

        • 宋曉利 2020年09月05日

          我也遇到這個問題了,你的解決了嗎

        thinkphp6專區有關的文章
        如果您有什么問題,歡迎咨詢我們客服! 點擊QQ咨詢