久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

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

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

      1. <tfoot id='HjgeI'></tfoot>
        <i id='HjgeI'><tr id='HjgeI'><dt id='HjgeI'><q id='HjgeI'><span id='HjgeI'><b id='HjgeI'><form id='HjgeI'><ins id='HjgeI'></ins><ul id='HjgeI'></ul><sub id='HjgeI'></sub></form><legend id='HjgeI'></legend><bdo id='HjgeI'><pre id='HjgeI'><center id='HjgeI'></center></pre></bdo></b><th id='HjgeI'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='HjgeI'><tfoot id='HjgeI'></tfoot><dl id='HjgeI'><fieldset id='HjgeI'></fieldset></dl></div>
          <bdo id='HjgeI'></bdo><ul id='HjgeI'></ul>
      2. 如何傳遞 PDO 參數數組但仍指定它們的類型?

        How can I pass an array of PDO parameters yet still specify their types?(如何傳遞 PDO 參數數組但仍指定它們的類型?)

        1. <i id='9cnxX'><tr id='9cnxX'><dt id='9cnxX'><q id='9cnxX'><span id='9cnxX'><b id='9cnxX'><form id='9cnxX'><ins id='9cnxX'></ins><ul id='9cnxX'></ul><sub id='9cnxX'></sub></form><legend id='9cnxX'></legend><bdo id='9cnxX'><pre id='9cnxX'><center id='9cnxX'></center></pre></bdo></b><th id='9cnxX'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='9cnxX'><tfoot id='9cnxX'></tfoot><dl id='9cnxX'><fieldset id='9cnxX'></fieldset></dl></div>

            <bdo id='9cnxX'></bdo><ul id='9cnxX'></ul>

                <small id='9cnxX'></small><noframes id='9cnxX'>

                1. <tfoot id='9cnxX'></tfoot>
                    <tbody id='9cnxX'></tbody>

                2. <legend id='9cnxX'><style id='9cnxX'><dir id='9cnxX'><q id='9cnxX'></q></dir></style></legend>
                3. 本文介紹了如何傳遞 PDO 參數數組但仍指定它們的類型?的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  $sql = "SELECT * FROM table WHERE id LIKE CONCAT('%', :id, '%')
                  LIMIT :limit1, :limit2";
                  

                  我仍然想像這樣使用數組輸入:

                  I want to still use the array input like this:

                  $stmt->execute($array);
                  

                  否則我無法重復使用相同的方法來執行我的查詢.

                  Otherwise I cannot reuse the same method for executing my queries.

                  同時,:limit1 和 :limit2 不起作用,除非像這樣輸入:

                  At the same time, the :limit1 and :limit2 doesn't work unless it is put in like this:

                  $stmt->bindParam(':limit1', $limit1, PDO::PARAM_INT);
                  

                  我嘗試兩者都做,但它沒有使用 bindParams 執行:

                  I tried to do both but it doesn't execute with the bindParams:

                  $stmt->bindParam(':limit2', $limit2, PDO::PARAM_INT);
                  $stmt->execute($array);
                  

                  有什么方法可以解決?

                  我想我可以擴展 PDOStatement 并添加一個新方法bindLimit"或其他東西,但我無法弄清楚 PDO 使用什么內部方法將參數綁定到變量.

                  I thought I could extend PDOStatement and add a new method "bindLimit" or something but I can't figure out what internal method PDO uses to bind parameters to a variable.

                  推薦答案

                  如果您關閉 PDO::ATTR_EMULATE_PREPARES 的默認設置,那么它就會起作用.我剛剛發現該設置默認為 mysql 啟用,這意味著您實際上從未使用過準備好的語句,php 在內部為您創建動態 sql,為您引用值并替換占位符.是的,一個主要的wtf.

                  If you turn off the default setting of PDO::ATTR_EMULATE_PREPARES, then it will work. I just found out that that setting is on by default for mysql, which means you never actually use prepared statements, php internally creates dynamic sql for you, quoting the values for you and replacing the placeholders. Ya, a major wtf.

                  $pdo->setAttribute(PDO::ATTR_EMULATE_PREPARES, false);
                  $stmt = $pdo->prepare($sql);
                  $stmt->execute(array(5)); //works!
                  

                  由于性能原因,默認情況下會模擬準備.

                  The prepares are emulated by default because of performance reasons.

                  另見PDO MySQL:使用PDO::ATTR_EMULATE_PREPARES 與否?

                  這篇關于如何傳遞 PDO 參數數組但仍指定它們的類型?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

                  【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

                  相關文檔推薦

                  MySQLi prepared statement amp; foreach loop(MySQLi準備好的語句amp;foreach 循環)
                  Is mysqli_insert_id() gets record from whole server or from same user?(mysqli_insert_id() 是從整個服務器還是從同一用戶獲取記錄?)
                  PHP MySQLi doesn#39;t recognize login info(PHP MySQLi 無法識別登錄信息)
                  mysqli_select_db() expects exactly 2 parameters(mysqli_select_db() 需要 2 個參數)
                  Php mysql pdo query: fill up variable with query result(Php mysql pdo 查詢:用查詢結果填充變量)
                  MySQLI 28000/1045 Access denied for user #39;root#39;@#39;localhost#39;(MySQLI 28000/1045 用戶“root@“localhost的訪問被拒絕)
                  <i id='KrEsp'><tr id='KrEsp'><dt id='KrEsp'><q id='KrEsp'><span id='KrEsp'><b id='KrEsp'><form id='KrEsp'><ins id='KrEsp'></ins><ul id='KrEsp'></ul><sub id='KrEsp'></sub></form><legend id='KrEsp'></legend><bdo id='KrEsp'><pre id='KrEsp'><center id='KrEsp'></center></pre></bdo></b><th id='KrEsp'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='KrEsp'><tfoot id='KrEsp'></tfoot><dl id='KrEsp'><fieldset id='KrEsp'></fieldset></dl></div>

                4. <small id='KrEsp'></small><noframes id='KrEsp'>

                        <bdo id='KrEsp'></bdo><ul id='KrEsp'></ul>
                        <tfoot id='KrEsp'></tfoot>

                          <tbody id='KrEsp'></tbody>

                            <legend id='KrEsp'><style id='KrEsp'><dir id='KrEsp'><q id='KrEsp'></q></dir></style></legend>
                          • 主站蜘蛛池模板: 欧美中文字幕一区二区 | 一级毛片免费看 | 看片wwwwwwwwwww | 在线观看日本网站 | 国产成人精品在线播放 | 色综合欧美 | 精品亚洲一区二区三区 | 超碰97人人人人人蜜桃 | 成人免费一区二区三区视频网站 | 国产四区 | 日韩在线一区视频 | 国产在线视频在线观看 | 一区二区三区欧美在线 | 国产欧美精品一区二区三区 | 国产精品一区二区视频 | 成人亚洲视频 | 一区二区三区观看视频 | 五月婷婷丁香婷婷 | 精品国产一区二区三区久久久蜜月 | av黄色片在线观看 | 欧美综合国产精品久久丁香 | 午夜国产| 亚洲91精品| 成人av资源在线 | 久久av一区二区三区 | 亚洲高清在线观看 | 国产sm主人调教女m视频 | 成在线人视频免费视频 | 日韩激情在线 | 欧美精品在线播放 | 97影院2| 成人免费视频网站在线观看 | 天天射视频 | 另类一区| 久久久成人免费一区二区 | 精品在线一区二区三区 | 国产aa| 国产精品久久久久久久久久久久久久 | 久久国内| 蜜桃av一区二区三区 | 麻豆毛片 |