我正在使用phalcon php和Mongo DB开发一个应用程序。我想从以下文档中选择post_type = 'page'
{
"_id" : ObjectId("53f896db461584542200002b"),
"post_con" : {
"post_date" : "12-05-14",
"post_title" : "Test",
"post_content" : "test content",
"post_category" : "test cat",
"post_type" : "page",
"post_status" : "published",
"post_modified" : "12-05-14"
},
"comment_status" : "open",
"link_code" : "test-page",
"seo" : {
"meta_desc" : "test desc",
"meta_key" : "test key"
}
}
答案 0 :(得分:0)
对于那些正在搜索相同内容的人来说,这是完整的代码。
$post = Posts::find(array(
'conditions'=>array('post_con.post_type'=>'blog') ));
$this->view->postlist = $post;
在视野中,
{% for posts in postlist %}
{{ posts.post_con['post_title'] }}
{{ posts.post_con['post_content'] }}
{% endfor %}
这对某人有帮助。