<small id='CqnZC'></small><noframes id='CqnZC'>

        <bdo id='CqnZC'></bdo><ul id='CqnZC'></ul>
      <legend id='CqnZC'><style id='CqnZC'><dir id='CqnZC'><q id='CqnZC'></q></dir></style></legend>

    1. <tfoot id='CqnZC'></tfoot>

      <i id='CqnZC'><tr id='CqnZC'><dt id='CqnZC'><q id='CqnZC'><span id='CqnZC'><b id='CqnZC'><form id='CqnZC'><ins id='CqnZC'></ins><ul id='CqnZC'></ul><sub id='CqnZC'></sub></form><legend id='CqnZC'></legend><bdo id='CqnZC'><pre id='CqnZC'><center id='CqnZC'></center></pre></bdo></b><th id='CqnZC'></th></span></q></dt></tr></i><div id='CqnZC'><tfoot id='CqnZC'></tfoot><dl id='CqnZC'><fieldset id='CqnZC'></fieldset></dl></div>
      1. Laravel:在另一个控制器中加载方法而不更改 url

        Laravel: Load method in another controller without changing the url(Laravel:在另一个控制器中加载方法而不更改 url)
        <legend id='cTt07'><style id='cTt07'><dir id='cTt07'><q id='cTt07'></q></dir></style></legend>

            <bdo id='cTt07'></bdo><ul id='cTt07'></ul>

            <small id='cTt07'></small><noframes id='cTt07'>

                <tbody id='cTt07'></tbody>
                  <tfoot id='cTt07'></tfoot>
                  <i id='cTt07'><tr id='cTt07'><dt id='cTt07'><q id='cTt07'><span id='cTt07'><b id='cTt07'><form id='cTt07'><ins id='cTt07'></ins><ul id='cTt07'></ul><sub id='cTt07'></sub></form><legend id='cTt07'></legend><bdo id='cTt07'><pre id='cTt07'><center id='cTt07'></center></pre></bdo></b><th id='cTt07'></th></span></q></dt></tr></i><div id='cTt07'><tfoot id='cTt07'></tfoot><dl id='cTt07'><fieldset id='cTt07'></fieldset></dl></div>
                  本文介绍了Laravel:在另一个控制器中加载方法而不更改 url的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我有这个路由:Route::controller('/', 'PearsController'); 在 Laravel 中是否有可能让 PearsController 从另一个控制器加载一个方法,这样 URL 就不会'改变?

                  I have this route: Route::controller('/', 'PearsController'); Is it possible in Laravel to get the PearsController to load a method from another controller so the URL doesn't change?

                  例如:

                  // route:
                  Route::controller('/', 'PearsController');
                  
                  
                  // controllers
                  class PearsController extends BaseController {
                  
                      public function getAbc() {
                          // How do I load ApplesController@getSomething so I can split up
                          // my methods without changing the url? (retains domain.com/abc)
                      }
                  
                  }
                  
                  class ApplesController extends BaseController {
                  
                      public function getSomething() {
                          echo 'It works!'
                      }
                  
                  }
                  

                  推荐答案

                  您可以使用(仅限 L3)

                  You can use (L3 only)

                  Controller::call('ApplesController@getSomething');
                  

                  L4中你可以使用

                  $request = Request::create('/apples', 'GET', array());
                  return Route::dispatch($request)->getContent();
                  

                  在这种情况下,你必须为ApplesController定义一个路由,就像这样

                  In this case, you have to define a route for ApplesController, something like this

                  Route::get('/apples', 'ApplesController@getSomething'); // in routes.php
                  

                  array() 中,如果需要,您可以传递参数.

                  In the array() you can pass arguments if required.

                  这篇关于Laravel:在另一个控制器中加载方法而不更改 url的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  Appending GET parameters to URL from lt;formgt; action(将 GET 参数附加到来自 lt;formgt; 的 URL行动)
                  Forcing quot;Save Asquot; dialog via jQuery GET(强制“另存为通过 jQuery GET 对话框)
                  PHP - get certain word from string(PHP - 从字符串中获取某个单词)
                  How to debug a get request in php using curl(如何使用 curl 在 php 中调试 get 请求)
                  get a # from a url in php(从 php 中的 url 获取 #)
                  PHP - include() file not working when variables are put in url?(PHP - 将变量放入 url 时,include() 文件不起作用?)
                      • <i id='PZB2T'><tr id='PZB2T'><dt id='PZB2T'><q id='PZB2T'><span id='PZB2T'><b id='PZB2T'><form id='PZB2T'><ins id='PZB2T'></ins><ul id='PZB2T'></ul><sub id='PZB2T'></sub></form><legend id='PZB2T'></legend><bdo id='PZB2T'><pre id='PZB2T'><center id='PZB2T'></center></pre></bdo></b><th id='PZB2T'></th></span></q></dt></tr></i><div id='PZB2T'><tfoot id='PZB2T'></tfoot><dl id='PZB2T'><fieldset id='PZB2T'></fieldset></dl></div>

                          <bdo id='PZB2T'></bdo><ul id='PZB2T'></ul>
                          <tfoot id='PZB2T'></tfoot>

                          <small id='PZB2T'></small><noframes id='PZB2T'>

                            <tbody id='PZB2T'></tbody>

                          <legend id='PZB2T'><style id='PZB2T'><dir id='PZB2T'><q id='PZB2T'></q></dir></style></legend>