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

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

      <tfoot id='R3e3z'></tfoot>

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

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

      1. 用 JavaScript 编码 Base64,用 GET 发送,用 PHP 解码

        时间:2023-10-03
        <i id='OJA4S'><tr id='OJA4S'><dt id='OJA4S'><q id='OJA4S'><span id='OJA4S'><b id='OJA4S'><form id='OJA4S'><ins id='OJA4S'></ins><ul id='OJA4S'></ul><sub id='OJA4S'></sub></form><legend id='OJA4S'></legend><bdo id='OJA4S'><pre id='OJA4S'><center id='OJA4S'></center></pre></bdo></b><th id='OJA4S'></th></span></q></dt></tr></i><div id='OJA4S'><tfoot id='OJA4S'></tfoot><dl id='OJA4S'><fieldset id='OJA4S'></fieldset></dl></div>
        • <legend id='OJA4S'><style id='OJA4S'><dir id='OJA4S'><q id='OJA4S'></q></dir></style></legend>
            <tbody id='OJA4S'></tbody>
            1. <small id='OJA4S'></small><noframes id='OJA4S'>

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

                1. <tfoot id='OJA4S'></tfoot>
                  本文介绍了用 JavaScript 编码 Base64,用 GET 发送,用 PHP 解码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  我认为这将是一个简单的谷歌搜索,但我的技术似乎并不像我想象的那么普遍.

                  I thought this will be an easy Google-search, but it seems that my technique is not as common as I thought.

                  我如何在 JavaScript 中 encode 一个 Base64 字符串,以便将它安全地放在带有 GET 参数的行上(我的 Base64 字符串包含很多/+=decodePHP中的相同字符串,以便将其存储在数据库中?

                  How can I encode a Base64 string in JavaScript, in order to put it safely on the line with a GET parameter (my Base64 string contains a lot of /, + and =, and decode the exact same string in PHP, in order to store it in a database?

                  当我发布没有编码的 Base64 字符串时,我的 PHP 脚本不接受它.

                  When I post the Base64 string without encoding, my PHP script does not accept it.

                  我找到了一个解决方案来编码和解码Base64字符串在 JavaScript 中,但对我来说没有意义.

                  I found a solution for encoding and decoding the Base64 string in JavaScript, but not in the way it makes sense for me.

                  推荐答案

                  所以在 javascript 中(更新为编码 URI):

                  So in javascript (updated with encoding URI):

                  var myStr = "I am the string to encode";
                  var token = encodeURIComponent(window.btoa(myStr));
                  

                  btoa 示例

                  然后您应该能够将该 base64 编码的字符串添加到您的获取请求中.

                  You should be then able to add that base64 encoded string to your get request.

                  然后在 PHP 中,在您检索请求之后:

                  Then in PHP, after you retrieve the request:

                  <?php
                     $str = 'VGhpcyBpcyBhbiBlbmNvZGVkIHN0cmluZw==';
                     echo base64_decode(urldecode($str));
                  ?>
                  

                  base64_decode 文档

                  这篇关于用 JavaScript 编码 Base64,用 GET 发送,用 PHP 解码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:在 php 中将 UTF-16LE 转换为 UTF-8 下一篇:base64 编码的字符串可以包含空格吗?

                  相关文章

                  最新文章

                2. <legend id='33ECq'><style id='33ECq'><dir id='33ECq'><q id='33ECq'></q></dir></style></legend>

                      <tfoot id='33ECq'></tfoot>

                      <small id='33ECq'></small><noframes id='33ECq'>

                        <bdo id='33ECq'></bdo><ul id='33ECq'></ul>

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