💎一站式轻松地调用各大LLM模型接口,支持GPT4、智谱、星火、月之暗面及文生图 广告
### findCount **计算符合条件的记录数量** **参数** $conditions: 找条件,数组array("字段名"=>"查找值")或字符串, ~~~ public function findCount($conditions = null) { $where = ""; if (is_array ( $conditions )) { $join = array (); foreach ( $conditions as $key => $condition ) { $condition = $this->__val_escape ( $condition ); $join [] = "{$key} = '{$condition}'"; } $where = "WHERE " . join ( " AND ", $join ); } else { if (null != $conditions) $where = "WHERE " . $conditions; } $sql = "SELECT COUNT({$this->pk}) as sp_counter FROM {$this->tbl_name} {$where}"; $result = $this->_db->getArray ( $sql ); return $result [0] ['sp_counter']; } ~~~