<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                合規國際互聯網加速 OSASE為企業客戶提供高速穩定SD-WAN國際加速解決方案。 廣告
                ~~~ <?php abstract class ActiveRecord { //表名 protected static $table; //參數涉及的類型 protected $fieldvalues; //查詢語句 public $select; //根據一個id來查 static function findById($id) { $query = "select * from " .static::$table ." where id = $id"; return self::createDomain($query); } function __get($fieldname) { // var_dump($this);die(); return $this->fieldvalues[$fieldname]; } static function __callStatic($method, $args) { $field = preg_replace('/^findBy(\w*)$/', '${1}', $method); $query = "select * from " .static::$table ." where $field = '$args[0]'"; return self::createDomain($query); } //query查詢語句,里面的todo,是做select中字段映射的 private static function createDomain($query) { //獲取調用的class $klass = get_called_class(); $domain = new $klass(); $domain->fieldvalues = []; $domain->select = $query; foreach ($klass::$fields as $field => $type) { //把類中$fields數組key和value變成這個 $domain->fieldvalues[$field] = 'TODO: set from sql result'; } // var_dump($domain);die; return $domain; } } class Customer extends ActiveRecord { //查詢的表名 protected static $table = 'custdb'; //涉及的類型 protected static $fields = [ 'id' => 'int', 'email' => 'varchar', 'lastname' => 'varchar' ]; } class Sales extends ActiveRecord { protected static $table = 'salesdb'; protected static $fields = [ 'id' => 'int', 'item' => 'varchar', 'qty' => 'int' ]; } assert("select * from custdb where id = 123" == Customer::findById(123)->select); assert("TODO: set from sql result" == Customer::findById(123)->email); assert("select * from salesdb where id = 321" == Sales::findById(321)->select); assert("select * from custdb where Lastname='Denoncourt'" == Customer::findByLastname('Denoncourt')->select); ~~~
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看