多应用+插件架构,代码干净,二开方便,首家独创一键云编译技术,文档视频完善,免费商用码云13.8K 广告
### 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']; } ~~~