/**
* 获取记录
* @param $field
* @return array
*/
function getone($field = '')
{
$this->limit('1');
if ($this->auto_cache or !empty($cache_id)) {
$cache_key = empty($cache_id) ? self::CACHE_PREFIX . '_one_' . md5($this->sql) : self::CACHE_PREFIX . '_all_' . $cache_id;
global $php;
$record = $php->cache->get($cache_key);
if (empty($data)) {
if ($this->is_execute == 0) {
$this->exeucte();
}
$record = $this->result->fetch();
$php->cache->set($cache_key, $record, $this->cache_life);
}
} else {
if ($this->is_execute == 0) {
$this->exeucte();
}
$record = $this->result->fetch();
}
if ($field === '') {
return $record;
}
return $record[$field];
}