public static function get_rows_num($table, $condition) { try { if (empty($table) || empty($condition)) { throw new Exception('查询记录数的表名,字段,条件不能为空', 444); } self::$sql = "SELECT count(*) AS total FROM {$table} WHERE {$condition}"; $result = self::query(self::$sql); $tmp = self::fetch_one(); return empty($tmp) ? false : $tmp['total']; } catch (Exception $e) { if (!defined('DEBUG_LEVEL') || !DEBUG_LEVEL) { } else { echo $e->getMessage(), '<br/>'; echo '<pre>', $e->getTraceAsString(), '</pre>'; echo '<strong>Query: </strong>[rows_num] ' . !empty(self::$sql) && self::$sql; } self::log($e->getMessage()); exit; } }