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

  • <legend id='0cqw5'><style id='0cqw5'><dir id='0cqw5'><q id='0cqw5'></q></dir></style></legend>
  • <small id='0cqw5'></small><noframes id='0cqw5'>

    • <bdo id='0cqw5'></bdo><ul id='0cqw5'></ul>
    <tfoot id='0cqw5'></tfoot>

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

        PHP PDO 獲取對象

        PHP PDO fetching into objects(PHP PDO 獲取對象)

            <small id='8688t'></small><noframes id='8688t'>

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

              • <tfoot id='8688t'></tfoot>

                <legend id='8688t'><style id='8688t'><dir id='8688t'><q id='8688t'></q></dir></style></legend>
                  本文介紹了PHP PDO 獲取對象的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  我試圖弄清楚如何從 PDO 獲取到我的自定義類,以及一般的 PDO 到對象 API,但我發現缺乏體面的文檔令人沮喪.大多數選項僅作為選項記錄在案,而示例都使用提取到數組中.
                  那么,有人可以解釋一下這些是如何使用的:

                  I am trying to figure out how to fetch from PDO into my custom class, and in general the PDO-to-object API, and am finding the lack of decent documentation frustrating. Most of the options are only documented as an option, while the examples all use fetching into arrays.
                  So, can someone explain how these are used:

                  • PDO::FETCH_OBJ
                  • PDO::FETCH_CLASS
                  • PDO::FETCH_CLASSTYPE
                  • PDO::FETCH_INTO
                  • PDO::FETCH_LAZY
                  • PDOStatement::fetch
                  • PDOStatement::fetchObject
                  • PDOStatement::setFetchMode

                  如果可能的話,我想要一個一般性的解釋,說明每個函數/常量是如何用于獲取對象的,或者有什么區別,以及我如何獲取到我的類中的具體答案,例如進入:

                  If possible, I would like a general explanation how each function/constant is used for fetching objects, or what the differences are, as well as a specific answer to how do I fetch into my class, e.g. into:

                  class MyRow {
                    public $col1, $col2;
                  }
                  

                  推薦答案

                  這是我設法弄清楚的:

                  • PDO::FETCH_OBJ
                    用于獲取未命名(匿名")對象的新實例

                  • PDO::FETCH_OBJ
                    Is used to fetch into a new instance of an unnamed ("anonymous") object

                  PDO::FETCH_CLASS
                  用于獲取現有類的新實例(列名應與現有屬性匹配,或者 __set 應用于接受所有屬性).類的構造函數將在屬性設置后調用.

                  PDO::FETCH_CLASS
                  Is used to fetch into a new instance of an existing class (the column names should match existing properties, or __set should be used to accept all properties). The constructor of the class will be called after the properties are set.

                  PDO::FETCH_CLASSTYPE
                  FETCH_CLASS(按位或)一起使用,創建實例的類名在第一列,而不是提供給函數.

                  PDO::FETCH_CLASSTYPE
                  Used with FETCH_CLASS (bitwise OR), the name of the class to create an instance of is in the first column, instead of supplied to the function.

                  PDO::FETCH_INTO
                  用于與 FETCH_CLASS 相同類型的類(必須將所有列作為屬性名稱處理),但更新現有對象而不是創建新對象.

                  PDO::FETCH_INTO
                  Is used with the same type of class as FETCH_CLASS (must handle all columns as property names), but updates an existing object as opposed to creating a new one.

                  PDO::FETCH_LAZY
                  我不知道這是做什么的.

                  PDO::FETCH_LAZY
                  I don't know what this does.

                  • PDOStatement::fetch
                    常規的 get-a-row 命令.我不知道如何將它與 FETCH_CLASSFETCH_INTO 一起使用,因為沒有任何方法可以傳遞類名/實例.

                  • PDOStatement::fetch
                    The regular get-a-row command. I don't know how to use this with FETCH_CLASS or FETCH_INTO since there does not be any way to pass the class name/instance.

                  PDOStatement::fetchObject
                  一種執行 FETCH_CLASSFETCH_INTO 的方法,包括傳遞構造函數參數.沒有參數是 FETCH_OBJ 的簡寫.

                  PDOStatement::fetchObject
                  A way to do FETCH_CLASS or FETCH_INTO, including passing constructor args. With no args is a shorthand for FETCH_OBJ.

                  PDOStatement::setFetchMode
                  一種設置默認獲取模式的方法,以便可以在沒有參數的情況下調用 PDOStatment::fetch.

                  PDOStatement::setFetchMode
                  A way to set the default fetch mode, so that PDOStatment::fetch can be called without args.

                  這是我想出的最好的方法.我希望它可以幫助其他人(我需要 fetchObject 方法)

                  That is the best I managed to figure out. I hope it helps someone else (I needed the fetchObject method)

                  這篇關于PHP PDO 獲取對象的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

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

                  相關文檔推薦

                  Deadlock exception code for PHP, MySQL PDOException?(PHP、MySQL PDOException 的死鎖異常代碼?)
                  PHP PDO MySQL scrollable cursor doesn#39;t work(PHP PDO MySQL 可滾動游標不起作用)
                  PHP PDO ODBC connection(PHP PDO ODBC 連接)
                  Using PDO::FETCH_CLASS with Magic Methods(使用 PDO::FETCH_CLASS 和魔術方法)
                  php pdo get only one value from mysql; value that equals to variable(php pdo 只從 mysql 獲取一個值;等于變量的值)
                  MSSQL PDO could not find driver(MSSQL PDO 找不到驅動程序)

                      1. <small id='pzI7o'></small><noframes id='pzI7o'>

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

                          • 主站蜘蛛池模板: 青青草网站在线观看 | 日日日操 | 毛片入口| 成人免费视频久久 | 成人免费黄视频 | 国产高清在线精品 | 国产午夜视频 | 日本久久久久久 | 亚洲在线看 | 日韩成人在线播放 | 欧美精品一区在线 | 久久最新精品 | 在线亚洲人成电影网站色www | 中文字幕中文字幕 | 狠狠狠干 | 狠狠撸在线视频 | 午夜精品久久 | 高清一区二区 | 99久久精品视频免费 | 91av在线视频观看 | 欧美不卡在线 | 精品熟人一区二区三区四区 | 超碰网址 | av黄在线观看 | 国产午夜精品久久久 | 91精品国产一区二区三区 | 人人爽人人草 | 国产综合视频 | 亚洲视频在线免费观看 | 欧美日韩高清一区 | 美女黄网 | 超碰精品在线观看 | 亚洲色图在线观看 | 欧美成人h版在线观看 | 久久精品网| 91精品国产91综合久久蜜臀 | 欧美a区 | 国产视频一区二区 | 第四色播日韩第一页 | 91最新视频| 国产视频1区2区 |