Cakephp在 Controller 中查找数据也可以使用sql语法,
示例:
$this->Post->find('all');
在 SQL 中:
select * from posts
将查询转换为 cakephp 查找语法可在 http://dogmatic69.com/sql-to-cakephp-find-converter 处找到。
但是如果我想将 cakephp find 转换为查询,是否有任何链接可供我使用。
提前致谢...
最佳答案
如果我明白你的问题,这就是答案
SQL calls that you can’t or don’t want to make via other model
methods can be made using the model’s query() method (though this
should only rarely be necessary).
query()
使用查询中的表名称作为返回数据的数组键,而不是模型名称。例如:
$this->POST->query("SELECT* from posts;");
这是 cakephp 的链接 documentation
关于php - Cakephp 查找转换为 Sql 语法,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37018115/