久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

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

    <tfoot id='IgeWP'></tfoot>

    <i id='IgeWP'><tr id='IgeWP'><dt id='IgeWP'><q id='IgeWP'><span id='IgeWP'><b id='IgeWP'><form id='IgeWP'><ins id='IgeWP'></ins><ul id='IgeWP'></ul><sub id='IgeWP'></sub></form><legend id='IgeWP'></legend><bdo id='IgeWP'><pre id='IgeWP'><center id='IgeWP'></center></pre></bdo></b><th id='IgeWP'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='IgeWP'><tfoot id='IgeWP'></tfoot><dl id='IgeWP'><fieldset id='IgeWP'></fieldset></dl></div>
      <legend id='IgeWP'><style id='IgeWP'><dir id='IgeWP'><q id='IgeWP'></q></dir></style></legend>
          <bdo id='IgeWP'></bdo><ul id='IgeWP'></ul>

        如何在 Zend Framework 2 中訪問(wèn)路由、發(fā)布、獲取等

        How to access route, post, get etc. parameters in Zend Framework 2(如何在 Zend Framework 2 中訪問(wèn)路由、發(fā)布、獲取等參數(shù))

              • <bdo id='hpOl2'></bdo><ul id='hpOl2'></ul>

                  <tbody id='hpOl2'></tbody>
                <tfoot id='hpOl2'></tfoot>

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

                • <i id='hpOl2'><tr id='hpOl2'><dt id='hpOl2'><q id='hpOl2'><span id='hpOl2'><b id='hpOl2'><form id='hpOl2'><ins id='hpOl2'></ins><ul id='hpOl2'></ul><sub id='hpOl2'></sub></form><legend id='hpOl2'></legend><bdo id='hpOl2'><pre id='hpOl2'><center id='hpOl2'></center></pre></bdo></b><th id='hpOl2'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='hpOl2'><tfoot id='hpOl2'></tfoot><dl id='hpOl2'><fieldset id='hpOl2'></fieldset></dl></div>
                • <legend id='hpOl2'><style id='hpOl2'><dir id='hpOl2'><q id='hpOl2'></q></dir></style></legend>

                • 本文介紹了如何在 Zend Framework 2 中訪問(wèn)路由、發(fā)布、獲取等參數(shù)的處理方法,對(duì)大家解決問(wèn)題具有一定的參考價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)吧!

                  問(wèn)題描述

                  限時(shí)送ChatGPT賬號(hào)..

                  如何在zf2中獲取與頁(yè)面請(qǐng)求相關(guān)的各種參數(shù)?像 post/get 參數(shù)、被訪問(wèn)的路由、發(fā)送的標(biāo)題和上傳的文件.

                  How can I get various parameters related to the page request in zf2? Like post/get parameters, the route being accessed, headers sent and files uploaded.

                  推薦答案

                  最簡(jiǎn)單的方法是使用 Params 插件,在 beta5 中引入.它具有實(shí)用方法,可以輕松訪問(wèn)不同類型的參數(shù).與往常一樣,閱讀測(cè)試可以證明對(duì)于了解應(yīng)該如何使用某物很有價(jià)值.

                  The easiest way to do that would be to use the Params plugin, introduced in beta5. It has utility methods to make it easy to access different types of parameters. As always, reading the tests can prove valuable to understand how something is supposed to be used.

                  要獲取控制器中命名參數(shù)的值,您需要為要查找的參數(shù)類型選擇適當(dāng)?shù)姆椒ú魅朊Q.

                  To get the value of a named parameter in a controller, you will need to select the appropriate method for the type of parameter you are looking for and pass in the name.

                  $this->params()->fromPost('paramname');   // From POST
                  $this->params()->fromQuery('paramname');  // From GET
                  $this->params()->fromRoute('paramname');  // From RouteMatch
                  $this->params()->fromHeader('paramname'); // From header
                  $this->params()->fromFiles('paramname');  // From file being uploaded
                  

                  所有這些方法還支持默認(rèn)值,如果沒有找到給定名稱的參數(shù),將返回這些默認(rèn)值.

                  All of these methods also support default values that will be returned if no parameter with the given name is found.

                  $orderBy = $this->params()->fromQuery('orderby', 'name');
                  

                  訪問(wèn) http://example.com/?orderby=birthdate 時(shí),$orderBy 的值為 birthdate.
                  訪問(wèn) http://example.com/ 時(shí),$orderBy 將具有 默認(rèn)name.

                  When visiting http://example.com/?orderby=birthdate, $orderBy will have the value birthdate.
                  When visiting http://example.com/, $orderBy will have the default value name.
                  ?

                  要獲取一種類型的所有參數(shù),只需不要傳入任何內(nèi)容,Params 插件將返回一個(gè)以名稱為鍵的值數(shù)組.

                  To get all parameters of one type, just don't pass in anything and the Params plugin will return an array of values with their names as keys.

                  $allGetValues = $this->params()->fromQuery(); // empty method call
                  

                  訪問(wèn)http://example.com/?orderby=birthdate&filter=hasphone時(shí) $allGetValues 將是一個(gè)類似

                  array(
                      'orderby' => 'birthdate',
                      'filter'  => 'hasphone',
                  );
                  

                  如果您查看源代碼 對(duì)于 Params 插件,您將看到它只是其他控制器的薄包裝器,以允許更一致的參數(shù)檢索.如果您出于某種原因想要/需要直接訪問(wèn)它們,您可以在源代碼中看到它是如何完成的.

                  If you check the source code for the Params plugin, you will see that it's just a thin wrapper around other controllers to allow for more consistent parameter retrieval. If you for some reason want/need to access them directly, you can see in the source code how it's done.

                  $this->getRequest()->getRequest('name', 'default');
                  $this->getEvent()->getRouteMatch()->getParam('name', 'default');
                  

                  注意:您可以使用超全局變量 $_GET、$_POST 等,但不鼓勵(lì)這樣做.

                  NOTE: You could have used the superglobals $_GET, $_POST etc., but that is discouraged.

                  這篇關(guān)于如何在 Zend Framework 2 中訪問(wèn)路由、發(fā)布、獲取等參數(shù)的文章就介紹到這了,希望我們推薦的答案對(duì)大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

                  【網(wǎng)站聲明】本站部分內(nèi)容來(lái)源于互聯(lián)網(wǎng),旨在幫助大家更快的解決問(wèn)題,如果有圖片或者內(nèi)容侵犯了您的權(quán)益,請(qǐng)聯(lián)系我們刪除處理,感謝您的支持!

                  相關(guān)文檔推薦

                  enable SOAP on PHP(在 PHP 上啟用 SOAP)
                  Get received XML from PHP SOAP Server(從 PHP SOAP 服務(wù)器獲取接收到的 XML)
                  not a valid AllXsd value(不是有效的 AllXsd 值)
                  PHP SoapClient: SoapFault exception Could not connect to host(PHP SoapClient:SoapFault 異常無(wú)法連接到主機(jī))
                  Implementation of P_SHA1 algorithm in PHP(PHP中P_SHA1算法的實(shí)現(xiàn))
                  Sending a byte array from PHP to WCF(將字節(jié)數(shù)組從 PHP 發(fā)送到 WCF)

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

                      <i id='FAufW'><tr id='FAufW'><dt id='FAufW'><q id='FAufW'><span id='FAufW'><b id='FAufW'><form id='FAufW'><ins id='FAufW'></ins><ul id='FAufW'></ul><sub id='FAufW'></sub></form><legend id='FAufW'></legend><bdo id='FAufW'><pre id='FAufW'><center id='FAufW'></center></pre></bdo></b><th id='FAufW'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='FAufW'><tfoot id='FAufW'></tfoot><dl id='FAufW'><fieldset id='FAufW'></fieldset></dl></div>
                    • <legend id='FAufW'><style id='FAufW'><dir id='FAufW'><q id='FAufW'></q></dir></style></legend>
                    • <tfoot id='FAufW'></tfoot>
                        <bdo id='FAufW'></bdo><ul id='FAufW'></ul>
                          <tbody id='FAufW'></tbody>

                            主站蜘蛛池模板: 亚洲国产69 | 国产成人高清在线观看 | 波多野结衣一二三区 | 成人av看片 | 国产乱码精品一区二区三区忘忧草 | 久操亚洲 | 在线观看深夜视频 | 自拍视频一区二区三区 | 国产精产国品一二三产区视频 | 国产精品美女 | 一区二区在线看 | 中文字幕一区二区三区乱码在线 | 欧美精品被 | 精品国产欧美日韩不卡在线观看 | 亚洲成人精品在线 | 精品无码久久久久久国产 | 亚洲精色 | 一区二区激情 | 久久99精品久久久久久国产越南 | 久久久久久久综合色一本 | 久久成人国产 | 欧美精品一区二区三区在线播放 | 成年人国产在线观看 | 久久久精品一区二区三区 | 国产在线第一页 | 国产一区二区三区在线看 | 91精品一区二区三区久久久久 | 国产精品99视频 | 欧美a在线| 久久精品成人 | 女同久久另类99精品国产 | 日韩欧美成人精品 | 中文字幕在线免费 | 精品无码久久久久久国产 | 亚洲成人精品 | 国产三区在线观看视频 | 国产欧美一区二区三区在线看 | 亚洲性人人天天夜夜摸 | 国产91丝袜在线18 | 日韩www | 亚洲免费网 |