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

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

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

        <legend id='wdnvJ'><style id='wdnvJ'><dir id='wdnvJ'><q id='wdnvJ'></q></dir></style></legend>
      1. 扩展 PDO 语句类

        时间:2023-10-05
      2. <i id='iOfpY'><tr id='iOfpY'><dt id='iOfpY'><q id='iOfpY'><span id='iOfpY'><b id='iOfpY'><form id='iOfpY'><ins id='iOfpY'></ins><ul id='iOfpY'></ul><sub id='iOfpY'></sub></form><legend id='iOfpY'></legend><bdo id='iOfpY'><pre id='iOfpY'><center id='iOfpY'></center></pre></bdo></b><th id='iOfpY'></th></span></q></dt></tr></i><div id='iOfpY'><tfoot id='iOfpY'></tfoot><dl id='iOfpY'><fieldset id='iOfpY'></fieldset></dl></div>
          <bdo id='iOfpY'></bdo><ul id='iOfpY'></ul>

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

            <tbody id='iOfpY'></tbody>

              1. <legend id='iOfpY'><style id='iOfpY'><dir id='iOfpY'><q id='iOfpY'></q></dir></style></legend>

              2. <tfoot id='iOfpY'></tfoot>
                  本文介绍了扩展 PDO 语句类的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  是否可以扩展 PHP PDO 语句类来为其添加自定义方法?这与扩展基本 PDO 类不同.如果是这样,由于语句类仅在通过 PDO 类运行查询时才返回,因此如何去做?

                  Is it possible to extend PHP PDO statement class to add custom methods to it? This would be different from extending the base PDO class. If so, how would one go about doing it since the statement class is only returned when running queries through the PDO class?

                  推荐答案

                  您可以使用 PDO::setAttribute():

                  You can set the class with PDO::setAttribute():

                  PDO::ATTR_STATEMENT_CLASS:设置从 PDOStatement 派生的用户提供的语句类.不能与持久 PDO 实例一起使用.需要数组(字符串类名,数组(混合构造函数_参数)).

                  PDO::ATTR_STATEMENT_CLASS: Set user-supplied statement class derived from PDOStatement. Cannot be used with persistent PDO instances. Requires array(string classname, array(mixed constructor_args)).

                  示例:

                  $pdo->setAttribute(PDO::ATTR_STATEMENT_CLASS, [Custom::class]);
                  

                  这篇关于扩展 PDO 语句类的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:PDO 连接和抽象类 下一篇:如何使用 CentOS 启用 PDO?

                  相关文章

                  最新文章

                  <tfoot id='MsMVq'></tfoot>

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

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