find($type, $params)
$type
可以是'all'
,'first'
,'count'
,'list'
,'neighbors'
或者'threaded'
的其中之一。默认情况下会使用'first'
进行查找。
$params
是一个下面所列出的选项作为默认key的数组,且都是可选的:
array('conditions' => array( 'Model.field' => $thisValue ), //条件数组'recursive' => 1 , //整型'fields' => array( 'Model.field1' , 'Model.field2' ), //字段名数组'order' => array( 'Model.created' , 'Model.field3 DESC' ), //定义顺序的字符串或者数组'group' => array( 'Model.field' ), //进行GROUP BY的字段'limit' => n , //整型'page' => n //整型'callbacks' => true //other possible values are false, 'before', 'after')
本文详细介绍了ORM中find方法的使用方式及其参数设置。find方法支持多种查询类型,包括'all'、'first'、'count'等,并可通过'conditions'、'recursive'等参数灵活定制查询条件。
247

被折叠的 条评论
为什么被折叠?



