本文整理汇总了PHP中Arrays::extract方法的典型用法代码示例。如果您正苦于以下问题:PHP Arrays::extract方法的具体用法?PHP Arrays::extract怎么用?PHP Arrays::extract使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Arrays
的用法示例。
在下文中一共展示了Arrays::extract方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: maintenance
protected function maintenance()
{
$rows = $this->db->rows('select identity, bt.reason, b.expire
from ban b
left join ban_type bt on b.type_id_ = bt.id
where (b.expire >= ' . $this->db->quote(new Time()) . ' or expire is null)');
$identityBans = Arrays::compileSubsOnKey($rows, 'identity');
foreach ($identityBans as $identity => $bans) {
$putBans = array();
foreach ($bans as $ban) {
$putBans[] = Arrays::extract(array('reason', 'expire'), $ban);
}
Cache::set('bans-' . $identity, serialize($putBans));
}
}
示例2: update
function update()
{
if ($this->validate()) {
$this->update = Arrays::extract($this->usedColumns, $this->control->in, $x = null, false);
unset($this->update['id']);
$this->lt->update = $this->update;
Db::update($this->lt->model['table'], $this->update, $this->control->id);
return true;
}
}
示例3: into
/**
@note insert ignore and insert update do not return a row id, so, if the id is not provided and the matchKeys are not provided, may not return row id
@return will attempt to get row id, otherwise will return count of affected rows
*/
protected function into($type, $table, $kvA, $update = '', $matchKeys = null)
{
$res = $this->query($type . ' INTO ' . $this->quoteIdentity($table) . $this->kvf($kvA) . $update);
if ($this->under->lastInsertId()) {
return $this->under->lastInsertId();
} elseif ($kvA['id']) {
return $kvA['id'];
} elseif ($matchKeys) {
$matchKva = Arrays::extract($matchKeys, $kvA);
return $this->row($table, $matchKva, 'id');
} else {
return $res->rowCount();
}
}