亚洲乱码中文字幕综合,中国熟女仑乱hd,亚洲精品乱拍国产一区二区三区,一本大道卡一卡二卡三乱码全集资源,又粗又黄又硬又爽的免费视频

fleaphp crud操作之find函數(shù)的使用方法

 更新時間:2011年04月23日 21:07:40   作者:  
fleaphp crud操作之find函數(shù)的用法,需要的朋友可以參考下。
find函數(shù)的原型
復制代碼 代碼如下:

/**
* 返回符合條件的第一條記錄及所有關(guān)聯(lián)的數(shù)據(jù),查詢沒有結(jié)果返回 false
*
* @param mixed $conditions
* @param string $sort
* @param mixed $fields
* @param mixed $queryLinks
*
* @return array
*/
function & find($conditions, $sort = null, $fields = '*', $queryLinks = true)
{
$rowset =& $this->findAll($conditions, $sort, 1, $fields, $queryLinks);
if (is_array($rowset)) {
$row = reset($rowset);
} else {
$row = false;
}
unset($rowset);
return $row;
}

find同findAll的區(qū)別在于find少了一個參數(shù)$limit,也就是說,find只會找出符合條件的第一條記錄
$conditions,
$sort = null,
$fields = ‘*'
$queryLinks = true
$conditions = null, 查詢條件
通常數(shù)組,包含字段名和值
例如
復制代碼 代碼如下:

array('fieldname' => 'value1','fieldnameb' => 'value2')

$sort = null, 排序
字段以及排序的方式,通常這是一個字串
例如
復制代碼 代碼如下:

'ID ASC,post_date DESC' //如果只有一個條件可以這樣 'ID ASC'

$fields = ‘*';, 需要查詢顯示的字段,默認全部顯示
例如
復制代碼 代碼如下:

array('ID','post_title','post_parent')

$queryLinks = true
fleaphp函數(shù)find方法的使用和示例
復制代碼 代碼如下:

$rowsets = $tableposts->find(array('post_type'=>'post'),'ID ASC,post_date DESC',array('ID','post_title','post_parent'));
dump($rowsets);

相關(guān)文章

最新評論