我明白了
"db":{"DBDriver":"MySQLi","connID":{},"resultID":true,"protectIdentifiers":true,"escapeChar":"`","likeEscapeStr":" ESCAPE '%s' ","likeEscapeChar":"!","dataCache":[],"transEnabled":true,"transStrict":true,"deleteHack":true,"mysqli":{},"resultMode":0,"numberNative":false,"save_queries":true}}
运行这个之后
$this->db->table($table)->set($set)->where('id', $id)->update();
return $this->db->getLastQuery();
我希望它返回这个
"UPDATE `table` SET `f` = 'v' WHERE `id` = 'id'"
就像他们对旧版更好的 Codeigniter 所做的那样
return $this->db->last_query();
您返回的
$this->db->getLastQuery();
是一个查询对象。从该对象获取最后一个查询的最简单方法是将其转换为string
:其作用与以下相同:
返回查询对象而不是实际查询的好处在于,它扩展了您可以从中获得什么的可能性。非常方便,尤其是调试时。例如
在任何处理之前获取原始语句或
查找慢查询。
有关查询对象的文档