1. <small id='b2sW4'></small><noframes id='b2sW4'>

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

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

      1. <legend id='b2sW4'><style id='b2sW4'><dir id='b2sW4'><q id='b2sW4'></q></dir></style></legend>
      2. <tfoot id='b2sW4'></tfoot>
      3. 提交表单时从 URL 中删除 %5B%5D

        Remove %5B%5D from URL when submitting form(提交表单时从 URL 中删除 %5B%5D)
          <legend id='yPKXn'><style id='yPKXn'><dir id='yPKXn'><q id='yPKXn'></q></dir></style></legend>
              <tbody id='yPKXn'></tbody>
              • <bdo id='yPKXn'></bdo><ul id='yPKXn'></ul>
                <tfoot id='yPKXn'></tfoot>

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

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

                1. 本文介绍了提交表单时从 URL 中删除 %5B%5D的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  当我提交一个包含多个同名复选框的表单时,我得到一个如下所示的 URL:www.mysite.com/search.php?myvalue%5B%5D=value1&myvalue%5B%5D=value2

                  When I submit a form with multiple checkboxes that have the same name I get a URL that looks something like this: www.mysite.com/search.php?myvalue%5B%5D=value1&myvalue%5B%5D=value2

                  有什么办法可以删除 %5B%5D 以使 URL漂亮",例如 htaccess?

                  Is there someway that I can remove the %5B%5D to make the URL "pretty", with something like htaccess?

                  代码:

                  <form>
                       <input type="checkbox" name="myvalue[]" value="value1">
                       <input type="checkbox" name="myvalue[]" value="value2">
                  </form>
                  

                  推荐答案

                  有什么办法可以删除 %5B%5D 以使 URL漂亮",例如 htaccess?

                  没有.[] 是 URL 中的保留字符,因此它们绝对需要URL 编码.

                  No. The [] are reserved characters in URLs, so they definitely need to be URL-encoded.

                  如果使用 POST 不是一个选项,考虑到它是一个搜索表单,这是有道理的,最好的办法是给它们每个一个不同的名称,值为 1 左右.

                  If using POST is not an option, which makes sense given that it's a search form, your best bet is to just give them each a different name with a value of 1 or so.

                  <form>
                      <input type="checkbox" name="option1" value="1" />
                      <input type="checkbox" name="option2" value="1" />
                  </form>
                  

                  或者,如果你真的坚持它们具有相同的名称,那么你应该自己提取查询字符串,而不是依赖 PHP 特定的特性,即在获取带有 [] 的参数时返回一个数组代码>名称中的后缀.

                  Or, if you really insist in them having the same name, then you should be extracting the query string yourself instead of relying on the PHP specific feature of returning an array when obtaining a parameter with a [] suffix in the name.

                  $params = explode('&', $_SERVER['QUERY_STRING']);
                  
                  foreach ($params as $param) {
                      $name_value = explode('=', $param);
                      $name = $name_value[0];
                      $value = $name_value[1];
                      // ... Collect them yourself.
                  }
                  

                  这样您就可以继续使用不带括号的名称.

                  This way you can just keep using the braceless name.

                  <form>
                      <input type="checkbox" name="option" value="option1" />
                      <input type="checkbox" name="option" value="option2" />
                  </form>
                  

                  这篇关于提交表单时从 URL 中删除 %5B%5D的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

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

                  相关文档推荐

                  DeepL的翻译效果还是很强大的,如果我们要用php实现DeepL翻译调用,该怎么办呢?以下是代码示例,希望能够帮到需要的朋友。 在这里需要注意,这个DeepL的账户和api申请比较难,不支持中国大陆申请,需要拥有香港或者海外信用卡才行,没账号的话,目前某宝可以
                  PHP通过phpspreadsheet导入Excel日期,导入系统后,全部变为了4开头的几位数字,这是为什么呢?原因很简单,将Excel的时间设置问文本,我们就能看到该日期本来的数值,上图对应的数值为: 要怎么解决呢?进行数据转换就行,这里可以封装方法,或者用第三方的
                  mediatemple - can#39;t send email using codeigniter(mediatemple - 无法使用 codeigniter 发送电子邮件)
                  Laravel Gmail Configuration Error(Laravel Gmail 配置错误)
                  Problem with using PHPMailer for SMTP(将 PHPMailer 用于 SMTP 的问题)
                  Issue on how to setup SMTP using PHPMailer in GoDaddy server(关于如何在 GoDaddy 服务器中使用 PHPMailer 设置 SMTP 的问题)
                  <tfoot id='4Z8S4'></tfoot>

                2. <legend id='4Z8S4'><style id='4Z8S4'><dir id='4Z8S4'><q id='4Z8S4'></q></dir></style></legend>
                      <bdo id='4Z8S4'></bdo><ul id='4Z8S4'></ul>

                          <tbody id='4Z8S4'></tbody>

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

                            <small id='4Z8S4'></small><noframes id='4Z8S4'>