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

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

      <tfoot id='QxHdq'></tfoot>
      1. 将 php $_GET 变量存储在 javascript 变量中?

        Storing php $_GET variable in a javascript variable?(将 php $_GET 变量存储在 javascript 变量中?)

          <bdo id='2I5Px'></bdo><ul id='2I5Px'></ul>
            <tbody id='2I5Px'></tbody>

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

            <small id='2I5Px'></small><noframes id='2I5Px'>

              <tfoot id='2I5Px'></tfoot>
              • <legend id='2I5Px'><style id='2I5Px'><dir id='2I5Px'><q id='2I5Px'></q></dir></style></legend>

                1. 本文介绍了将 php $_GET 变量存储在 javascript 变量中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我正在使用 $_GET 方法(team1、team2)将两条信息传递给一个 php 页面.我想在一些 javascript 中使用这些作为变量.我该怎么做?

                  I am passing two pieces of info to a php page using the $_GET method (team1, team2). I'd like to use these as variables in some javascript. How can I do this?

                  谢谢

                  推荐答案

                  原答案:

                  在您的 .php 文件中.

                  In your .php file.

                  <script type="text/javascript"> 
                    var team1, team2; 
                    team1 = <?php echo $_GET['team1']; ?>; 
                    team1 = <?php echo $_GET['team1']; ?>; 
                  </script>
                  

                  更安全的答案:

                  当我爆出这个答案时,甚至没有考虑 XSS.(看评论!)$_GET 数组中的任何内容都应该转义,否则用户几乎可以将他们想要的任何 JS 插入到您的页面中.所以尝试这样的事情:

                  Didn't even think about XSS when I blasted this answer out. (Look at the comments!) Anything from the $_GET array should be escaped, otherwise a user can pretty much insert whatever JS they want into your page. So try something like this:

                  <script type="text/javascript"> 
                    var team1, team2; 
                    team1 = <?php echo htmlencode(json_encode($_GET['team1'])); ?>; 
                    team1 = <?php echo htmlencode(json_encode($_GET['team1'])); ?>; 
                  </script>
                  

                  从这里 http://www.bytetouch.com/blog/programming/protecting-php-scripts-from-cross-site-scripting-xss-attacks/.

                  来自 Google 的有关 XSS 的更多信息 http://code.google.com/p/doctype/wiki/ArticleXSSInJavaScript.

                  More about XSS from Google http://code.google.com/p/doctype/wiki/ArticleXSSInJavaScript.

                  为评论者干杯.

                  这篇关于将 php $_GET 变量存储在 javascript 变量中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

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

                  相关文档推荐

                  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 的问题)

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

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

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