• <legend id='Q23OW'><style id='Q23OW'><dir id='Q23OW'><q id='Q23OW'></q></dir></style></legend>

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

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

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

      3. PDO 通过引用通知?

        时间:2023-09-20
        <i id='iPHCL'><tr id='iPHCL'><dt id='iPHCL'><q id='iPHCL'><span id='iPHCL'><b id='iPHCL'><form id='iPHCL'><ins id='iPHCL'></ins><ul id='iPHCL'></ul><sub id='iPHCL'></sub></form><legend id='iPHCL'></legend><bdo id='iPHCL'><pre id='iPHCL'><center id='iPHCL'></center></pre></bdo></b><th id='iPHCL'></th></span></q></dt></tr></i><div id='iPHCL'><tfoot id='iPHCL'></tfoot><dl id='iPHCL'><fieldset id='iPHCL'></fieldset></dl></div>
          <tbody id='iPHCL'></tbody>
      4. <legend id='iPHCL'><style id='iPHCL'><dir id='iPHCL'><q id='iPHCL'></q></dir></style></legend>

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

          <tfoot id='iPHCL'></tfoot>

                  <bdo id='iPHCL'></bdo><ul id='iPHCL'></ul>
                  本文介绍了PDO 通过引用通知?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  这个:

                  $stmt = $dbh->prepare("SELECT thing FROM table WHERE color = :color");
                  $stmt->bindParam(':color', $someClass->getColor());
                  $stmt->execute();
                  

                  产生这个:

                  运行时通知
                  只应传递变量参考

                  Runtime notice
                  Only variables should be passed by reference

                  虽然它仍然执行.

                  这个:

                  $stmt = $dbh->prepare("SELECT thing FROM table WHERE color = :color");
                  $tempColor = $someClass->getColor();
                  $stmt->bindParam(':color',$tempColor);
                  $stmt->execute();
                  

                  毫无怨言地运行.

                  我不明白其中的区别?

                  推荐答案

                  bindParam 的第二个参数是一个变量 参考.由于函数返回不能被引用,它不能严格满足bindParam参数的需求(PHP会配合你,这里只会发出警告).

                  The second parameter of bindParam is a variable reference. Since a function return cannot be referenced, it fails to strictly meet the needs of the bindParam parameter (PHP will work with you though and will only issue a warning here).

                  为了更好地理解,这里有一个例子:这段代码将产生与你的第二个例子相同的结果:

                  To get a better idea, here's and example: this code will produce the same results as your second example:

                  $stmt = $dbh->prepare("SELECT thing FROM table WHERE color = :color");
                  $tempColor = NULL; // assigned here
                  $stmt->bindParam(':color',$tempColor);
                  $tempColor = $someClass->getColor(); // but reassigned here
                  $stmt->execute();
                  

                  这在函数返回的情况下是不可能的.

                  That won't be possible with a function return.

                  这篇关于PDO 通过引用通知?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:可捕获的致命错误:无法在第 114 行将类 PDOStatem 下一篇:PHP PDO 连接到具有集成安全性的 SQL Server?

                  相关文章

                  最新文章

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

                    1. <tfoot id='N9Giq'></tfoot>
                        <bdo id='N9Giq'></bdo><ul id='N9Giq'></ul>

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