0
public function groups()
{
$this->trigger_events('groups');
// run each where that was passed
if (isset($this->_ion_where) && !empty($this->_ion_where))
{
foreach ($this->_ion_where as $where)
{
$this->db->where($where);
}
$this->_ion_where = array();
}
if (isset($this->_ion_limit) && isset($this->_ion_offset))
{
$this->db->limit($this->_ion_limit, $this->_ion_offset);
$this->_ion_limit = NULL;
$this->_ion_offset = NULL;
}
else if (isset($this->_ion_limit))
{
$this->db->limit($this->_ion_limit);
$this->_ion_limit = NULL;
}
// set the order
if (isset($this->_ion_order_by) && isset($this->_ion_order))
{
$this->db->order_by($this->_ion_order_by, $this->_ion_order);
}
$this->response = $this->db->get($this->tables['groups']);
return $this;
}
似乎廢話我,你可以從組看到()的原生功能上面,爲什麼使用自定義_ion_limit,_ion_offset, _ion_where當CI已經給你選擇寫本地where() - > limit() - > get()時,保留它自己的私人_ion_limit,_ion_offset,_ion_where私有屬性對工作流程有什麼好處?我是否錯過了這裏的一些部分或者是否存在某種設計模式?爲什麼離子權威性庫的使用習慣,其中()而不是使用其中()CI提供
也許是真的,似乎編寫sql語句會更靈活 – user7031