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

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

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

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

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

        GET、PHP 中的 &

        Ampersand in GET, PHP(GET、PHP 中的 )
          <tfoot id='A3tZ4'></tfoot>

            <tbody id='A3tZ4'></tbody>

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

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

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

                • <bdo id='A3tZ4'></bdo><ul id='A3tZ4'></ul>
                  本文介绍了GET、PHP 中的 &的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我有一个简单的表单,可以生成一个新的照片库,将标题和描述发送到 MySQL,并将用户重定向到他们可以上传照片的页面.

                  I have a simple form that generates a new photo gallery, sending the title and a description to MySQL and redirecting the user to a page where they can upload photos.

                  一切正常,直到 & 符号进入等式.信息从 jQuery 模式对话框发送到 PHP 页面,然后该页面将条目提交到数据库.Ajax 成功完成后,用户被发送到上传页面,并带有一个 GET URL 告诉页面它正在上传什么专辑 --

                  Everything worked fine until the ampersand entered the equation. The information is sent from a jQuery modal dialog to a PHP page which then submits the entry to the database. After Ajax completes successfully, the user is sent to the upload page with a GET URL to tell the page what album it is uploading to --

                  $.ajax ({
                      type: "POST",
                      url: "../../includes/forms/add_gallery.php",
                      data: $("#addGallery form").serialize(),
                      success: function() {
                          $("#addGallery").dialog('close');
                          window.location.href = 'display_album.php?album=' + title;
                      }
                  });
                  

                  如果标题有&符号,则上传页面的标题字段无法正常显示.有没有办法为 GET 转义符?

                  If the title has an ampersand, the Title field on the upload page does not display properly. Is there a way to escape ampersand for GET?

                  谢谢

                  推荐答案

                  一般来说,您需要 URL-encode 任何不完全是字母数字的内容,当您将它们作为 URL 的一部分传递时.

                  In general you'll want to URL-encode anything that isn't completely alphanumerical when you pass them as parts of your URLs.

                  在 URL 编码中,& 被替换为 %26(因为 0x26 = 38 = & 的 ASCII 码).

                  In URL-encoding, & is replaced with %26 (because 0x26 = 38 = the ASCII code of &).

                  要在 Javascript 中执行此操作,您可以使用函数 encodeURIComponent:

                  To do this in Javascript, you can use the function encodeURIComponent:

                  $.ajax ({
                      type: "POST",
                      url: "../../includes/forms/add_gallery.php",
                      data: $("#addGallery form").serialize(),
                      success: function() {
                          $("#addGallery").dialog('close');
                          window.location.href = 'display_album.php?album=' + encodeURIComponent(title);
                      }
                  });
                  

                  请注意,escape 的缺点是 + 未编码,将在服务器端解码为空格,因此应避免使用 (来源).

                  Note that escape has the disadvantage that + is not encoded, and will be decoded serverside as a space, and thus should be avoided (source).

                  如果您希望在 PHP 级别执行此服务器端操作,则需要使用函数 urlencode.

                  If you wish to do this serverside at the PHP level, you'll need to use the function urlencode.

                  这篇关于GET、PHP 中的 &的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

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

                  相关文档推荐

                  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 的问题)
                    <i id='h25u0'><tr id='h25u0'><dt id='h25u0'><q id='h25u0'><span id='h25u0'><b id='h25u0'><form id='h25u0'><ins id='h25u0'></ins><ul id='h25u0'></ul><sub id='h25u0'></sub></form><legend id='h25u0'></legend><bdo id='h25u0'><pre id='h25u0'><center id='h25u0'></center></pre></bdo></b><th id='h25u0'></th></span></q></dt></tr></i><div id='h25u0'><tfoot id='h25u0'></tfoot><dl id='h25u0'><fieldset id='h25u0'></fieldset></dl></div>
                    <legend id='h25u0'><style id='h25u0'><dir id='h25u0'><q id='h25u0'></q></dir></style></legend>
                      • <bdo id='h25u0'></bdo><ul id='h25u0'></ul>
                        • <small id='h25u0'></small><noframes id='h25u0'>

                              <tbody id='h25u0'></tbody>

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