【问题标题】:different with insert active records与插入活动记录不同
【发布时间】:2017-01-18 14:06:36
【问题描述】:

谁能简单解释一下与

的区别
$this->actions->add_record($some)

$this->db->insert($some)

据我所知,他们都插入数据,但我不确定其中的区别,也无法在网上找到很好的解释

【问题讨论】:

  • actions->add_record 你从哪里得到的??
  • 我从没听说过 CI 有这种方法
  • 你真的在使用 CI 吗?你能给我一个我感兴趣的链接吗?
  • @teckwei 以上评论属于我??
  • @AbdullaNilam 不,我对作者发表评论。因为我也从未听说过。我认为该方法来自活动记录?

标签: php mysql codeigniter activerecord


【解决方案1】:
$this->actions->add_record($some);

是用户定义的函数 但是

$this->db->insert($some);

是 Codeigniter 的 Query Builder Class 的内置函数,将数据插入到这样的表中:

$this->db->insert('users',array('name'=>'john));

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2011-09-28
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-04-18
    • 2014-12-15
    相关资源
    最近更新 更多