The prototype of the find function
Copy the code The code is as follows:
/**
* Returns the first record that meets the conditions and all associated data. If the query has no result, it returns 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;
}
Copy the code The code is as follows:
array('fieldname' => 'value1','fieldnameb' => 'value2')
Copy code The code is as follows:
'ID ASC,post_date DESC' //If there is only one condition, this can be 'ID ASC'
Copy the code The code is as follows:
array('ID','post_title','post_parent')
Copy code The code is as follows:
$rowsets = $tableposts->find(array('post_type'=>'post'),'ID ASC,post_date DESC',array('ID','post_title','post_parent'));
dump($rowsets);
The above introduces how to use the find function of fleaphp fleaphp crud operation, including the content of fleaphp. I hope it will be helpful to friends who are interested in PHP tutorials.