简体   繁体   English

在PHP F3框架中使用ORM Axon选择语句

[英]Select statement using ORM Axon in the php F3 framework

I am brand new to the Fat-Free-Framework F3 for PHP 我是PHP的无脂肪框架F3的新手
I am trying to build a blog 我正在尝试建立一个博客
I have a simple query 我有一个简单的查询

'SELECT * FROM blogs  ORDER BY created DESC LIMIT 5'  

I want to build this query using the Axon ORM that is built in to the F3 framework 我想使用F3框架中内置的Axon ORM构建此查询

In my thinking I want to try this: 我想尝试一下:

     $blogs = new Axon('blogs');
     $blogs->load(array('limit'=>5, 'order by'=>'created', 'order'=>'DESC'));

Is this the correct way? 这是正确的方法吗?
Does anyone know of any good Axon documentation? 有谁知道任何好的Axon文档?

Thanks 谢谢

This will do it. 这样就可以了。 You can loop through $posts as Axon objects now. 您现在可以遍历$ posts作为Axon对象。

$blogs = new Axon('blogs');
$posts = $blogs->find('','created DESC',5);

While Fatfree seems simple and easy, it pales in comparison to what is out there. 尽管Fatfree看起来既简单又轻松,但与市面上的东西相比却显得苍白。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM