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

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

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

    <tfoot id='eFXOQ'></tfoot>

    1. <i id='eFXOQ'><tr id='eFXOQ'><dt id='eFXOQ'><q id='eFXOQ'><span id='eFXOQ'><b id='eFXOQ'><form id='eFXOQ'><ins id='eFXOQ'></ins><ul id='eFXOQ'></ul><sub id='eFXOQ'></sub></form><legend id='eFXOQ'></legend><bdo id='eFXOQ'><pre id='eFXOQ'><center id='eFXOQ'></center></pre></bdo></b><th id='eFXOQ'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='eFXOQ'><tfoot id='eFXOQ'></tfoot><dl id='eFXOQ'><fieldset id='eFXOQ'></fieldset></dl></div>
      • <bdo id='eFXOQ'></bdo><ul id='eFXOQ'></ul>
      1. 從 mysql_connect() 獲取 PHP PDO 連接?

        Getting a PHP PDO connection from a mysql_connect()?(從 mysql_connect() 獲取 PHP PDO 連接?)

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

            • <tfoot id='Fb5nH'></tfoot>

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

                    <tbody id='Fb5nH'></tbody>

                  <i id='Fb5nH'><tr id='Fb5nH'><dt id='Fb5nH'><q id='Fb5nH'><span id='Fb5nH'><b id='Fb5nH'><form id='Fb5nH'><ins id='Fb5nH'></ins><ul id='Fb5nH'></ul><sub id='Fb5nH'></sub></form><legend id='Fb5nH'></legend><bdo id='Fb5nH'><pre id='Fb5nH'><center id='Fb5nH'></center></pre></bdo></b><th id='Fb5nH'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='Fb5nH'><tfoot id='Fb5nH'></tfoot><dl id='Fb5nH'><fieldset id='Fb5nH'></fieldset></dl></div>
                  <legend id='Fb5nH'><style id='Fb5nH'><dir id='Fb5nH'><q id='Fb5nH'></q></dir></style></legend>
                  本文介紹了從 mysql_connect() 獲取 PHP PDO 連接?的處理方法,對(duì)大家解決問題具有一定的參考價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)吧!

                  問題描述

                  我有一個(gè)舊的 PHP/MySQL 應(yīng)用程序,它調(diào)用 mysql_connect().大量現(xiàn)有的下游代碼使用此連接直接或通過包裝器進(jìn)行 mysql_query() 調(diào)用.

                  I have a legacy PHP/MySQL app that calls mysql_connect(). Tons of existing downstream code makes mysql_query() calls, either directly or through wrappers, using this connection.

                  對(duì)于我在應(yīng)用程序上開發(fā)的新代碼,我想開始使用 PDO.

                  For new code that I develop on the app, I would like to start using PDO.

                  如果我使用相同的主機(jī)/用戶/密碼/dbname 憑據(jù)建立 PDO 連接,我是否很幸運(yùn),在幕后,PHP 將重新使用原始連接?或者 PHP 是否會(huì)創(chuàng)建到服務(wù)器的兩個(gè)不同的連接(不合需要,盡管完全可以理解)?

                  If I make a PDO connection using the same host/user/pass/dbname credentials, might I be so lucky that under the hood, PHP will re-use the original connection? Or will PHP create two distinct connections to the server (undesirable, albeit totally understandable)?

                  謝謝!

                  推薦答案

                  如果您使用兩個(gè)不同的 API(即 mysql_* 和 PDO),PHP 將生成兩個(gè)不同的連接.

                  If you are using two different APIs (i.e. mysql_* and PDO), PHP will generate two different connections.


                  并且,作為證明",請(qǐng)考慮這部分代碼:


                  And, as a "proof", consider this portion of code :

                  $db = mysql_connect('localhost', 'USER', 'PASSWORD');
                  $pdo = new PDO('mysql://@localhost/astralblog', 'USER', 'PASSWORD');
                  sleep(5);
                  


                  運(yùn)行這將在 MySQL 服務(wù)器上產(chǎn)生兩個(gè)不同的連接——它將休眠 5 秒:


                  Running this will cause two distinct connections, on the MySQL server -- which will sleep for 5 seconds :

                  mysql> show processlist;
                  +----+------------+-----------------+------------+---------+------+-------+------------------+
                  | Id | User       | Host            | db         | Command | Time | State | Info             |
                  +----+------------+-----------------+------------+---------+------+-------+------------------+
                  | 41 | astralblog | localhost:46551 | astralblog | Sleep   |  188 |       | NULL             |
                  | 42 | astralblog | localhost:46552 | astralblog | Sleep   |  188 |       | NULL             |
                  | 43 | astralblog | localhost       | astralblog | Query   |    0 | NULL  | show processlist |
                  | 64 | astralblog | localhost       | NULL       | Sleep   |    4 |       | NULL             |
                  | 65 | astralblog | localhost       | NULL       | Sleep   |    4 |       | NULL             |
                  +----+------------+-----------------+------------+---------+------+-------+------------------+
                  5 rows in set (0,00 sec)
                  

                  (有問題的連接是最后兩個(gè),在我啟動(dòng)PHP腳本時(shí)出現(xiàn),5秒后消失)

                  這篇關(guān)于從 mysql_connect() 獲取 PHP PDO 連接?的文章就介紹到這了,希望我們推薦的答案對(duì)大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

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

                  相關(guān)文檔推薦

                  MySQLi prepared statement amp; foreach loop(MySQLi準(zhǔn)備好的語句amp;foreach 循環(huán))
                  Is mysqli_insert_id() gets record from whole server or from same user?(mysqli_insert_id() 是從整個(gè)服務(wù)器還是從同一用戶獲取記錄?)
                  PHP MySQLi doesn#39;t recognize login info(PHP MySQLi 無法識(shí)別登錄信息)
                  mysqli_select_db() expects exactly 2 parameters(mysqli_select_db() 需要 2 個(gè)參數(shù))
                  Php mysql pdo query: fill up variable with query result(Php mysql pdo 查詢:用查詢結(jié)果填充變量)
                  MySQLI 28000/1045 Access denied for user #39;root#39;@#39;localhost#39;(MySQLI 28000/1045 用戶“root@“l(fā)ocalhost的訪問被拒絕)

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

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

                        • <legend id='2SFLW'><style id='2SFLW'><dir id='2SFLW'><q id='2SFLW'></q></dir></style></legend>
                            <tbody id='2SFLW'></tbody>
                          1. <tfoot id='2SFLW'></tfoot>
                            主站蜘蛛池模板: 欧美精品一二区 | 精品亚洲一区二区三区 | 成人二区 | 中国一级特黄视频 | 精品视频免费 | 日韩高清不卡 | 中文字幕亚洲区一区二 | 五月激情久久 | 国产成人精品视频在线观看 | 欧美在线视频不卡 | 成人欧美一区二区 | 99精品视频一区二区三区 | 男女羞羞视频大全 | 深夜福利亚洲 | 成年人免费在线视频 | 黄色大片免费网站 | 自拍视频在线观看 | 久久久亚洲一区 | 一区二区三区精品视频 | 麻豆久久久| 毛片网站在线观看 | 女同av亚洲女人天堂 | 国产福利久久 | yiren22 亚洲综合 | 亚洲高清在线 | xx性欧美肥妇精品久久久久久 | 日韩av在线一区二区 | 成人在线一区二区三区 | 日本特黄a级高清免费大片 成年人黄色小视频 | 插插插干干干 | 国产精品伦一区二区三级视频 | 久久色视频| 日韩欧美专区 | 最新黄色在线观看 | 午夜国产| 亚洲精品视频在线观看免费 | 亚洲成人久久久 | 国产美女视频黄a视频免费 国产精品福利视频 | 欧美国产日韩在线观看成人 | 成人黄色三级毛片 | 亚洲一区 中文字幕 |