StartMVC开发手册

可以快速上手的开发文档

手册目录

结果集

查询历史queryHistory()

用于返回一个查询数组,含有sql语句、参数、来源

var_dump($db->queryHistory());
Array
(
	[0] => Array
		(
			[query] => SELECT id, name FROM products WHERE code = ? AND active = ? ORDER BY id desc
			[params] => Array
				(
					[0] => 34066
					[1] => 1
				)
			[from] => redis
		)
)

上次查询的sql语句lastQuery()

echo $db->lastQuery();

//SELECT id, name FROM products WHERE code = ? AND active = ? ORDER BY id desc

上次查询的参数lastParams()

用于查看上次查询sql语句的参数

var_dump($db->lastParams());
Array
(
    [0] => 34066,
    [1] => 1
)

查询总数queryCount()

返回查询的总数

echo $db->queryCount();
//1