• <i id='yGRxS'><tr id='yGRxS'><dt id='yGRxS'><q id='yGRxS'><span id='yGRxS'><b id='yGRxS'><form id='yGRxS'><ins id='yGRxS'></ins><ul id='yGRxS'></ul><sub id='yGRxS'></sub></form><legend id='yGRxS'></legend><bdo id='yGRxS'><pre id='yGRxS'><center id='yGRxS'></center></pre></bdo></b><th id='yGRxS'></th></span></q></dt></tr></i><div id='yGRxS'><tfoot id='yGRxS'></tfoot><dl id='yGRxS'><fieldset id='yGRxS'></fieldset></dl></div>

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

      <legend id='yGRxS'><style id='yGRxS'><dir id='yGRxS'><q id='yGRxS'></q></dir></style></legend>
    1. <tfoot id='yGRxS'></tfoot>

        <bdo id='yGRxS'></bdo><ul id='yGRxS'></ul>
      1. 如何在 Symfony2 控制器中获取操作名称?

        How can I get the action name in a Symfony2 controller?(如何在 Symfony2 控制器中获取操作名称?)

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

                <tbody id='rxNrh'></tbody>

              1. <legend id='rxNrh'><style id='rxNrh'><dir id='rxNrh'><q id='rxNrh'></q></dir></style></legend>
                  <i id='rxNrh'><tr id='rxNrh'><dt id='rxNrh'><q id='rxNrh'><span id='rxNrh'><b id='rxNrh'><form id='rxNrh'><ins id='rxNrh'></ins><ul id='rxNrh'></ul><sub id='rxNrh'></sub></form><legend id='rxNrh'></legend><bdo id='rxNrh'><pre id='rxNrh'><center id='rxNrh'></center></pre></bdo></b><th id='rxNrh'></th></span></q></dt></tr></i><div id='rxNrh'><tfoot id='rxNrh'></tfoot><dl id='rxNrh'><fieldset id='rxNrh'></fieldset></dl></div>
                • <small id='rxNrh'></small><noframes id='rxNrh'>

                  本文介绍了如何在 Symfony2 控制器中获取操作名称?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  有没有办法在 Symfony2 控制器中获取动作的名称?

                  Is there a way to get the name of the action in a Symfony2 controller?

                  public function createAction(Request $request, $title) {
                  
                      // Expected result: create
                      $name = $this->getActionName();
                  
                  }
                  

                  推荐答案

                  使用:

                  $request->attributes->get('_controller');
                  // will get yourBundleControlleryourController::CreateAction
                  
                  $params = explode('::',$request->attributes->get('_controller'));
                  // $params[1] = 'createAction';
                  
                  $actionName = substr($params[1],0,-6);
                  // $actionName = 'create';
                  

                  这篇关于如何在 Symfony2 控制器中获取操作名称?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

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

                  相关文档推荐

                  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() 文件不起作用?)
                • <legend id='Ctigp'><style id='Ctigp'><dir id='Ctigp'><q id='Ctigp'></q></dir></style></legend>

                    <tbody id='Ctigp'></tbody>
                    <tfoot id='Ctigp'></tfoot>
                        <bdo id='Ctigp'></bdo><ul id='Ctigp'></ul>

                        1. <i id='Ctigp'><tr id='Ctigp'><dt id='Ctigp'><q id='Ctigp'><span id='Ctigp'><b id='Ctigp'><form id='Ctigp'><ins id='Ctigp'></ins><ul id='Ctigp'></ul><sub id='Ctigp'></sub></form><legend id='Ctigp'></legend><bdo id='Ctigp'><pre id='Ctigp'><center id='Ctigp'></center></pre></bdo></b><th id='Ctigp'></th></span></q></dt></tr></i><div id='Ctigp'><tfoot id='Ctigp'></tfoot><dl id='Ctigp'><fieldset id='Ctigp'></fieldset></dl></div>

                          • <small id='Ctigp'></small><noframes id='Ctigp'>