人人人妻人人人妻人人人,99精品国产综合久久久久五月天 ,欧美白人最猛性XXXXX,日韩AV无码免费播放

News新聞

業(yè)界新聞動態(tài)、技術(shù)前沿
Who are we?

您的位置:首頁      樂道系統(tǒng)FAQ      基于thinkPHP類的插入數(shù)據(jù)庫操作功能示例

基于thinkPHP類的插入數(shù)據(jù)庫操作功能示例

標簽: 發(fā)布日期:2017-01-06 00:00:00 292

本文實例講述了基于thinkPHP類的插入數(shù)據(jù)庫操作功能。分享給大家供大家參考,具體如下:

基于TP類的插入數(shù)據(jù)庫操作

/**************************
* 插入互動專家的數(shù)據(jù)
*
* @param object $model        實例化的模型
* @param array $Model        獲取到的專家數(shù)據(jù)
* @param int  $result      插入成功后返回的id
* @date 2016/02/19
* @write zss
****************************/
private function collect_sp_t_insert($model){
    $model = D($model);
    //刪除主鍵,防止此操作成為更新操作
    unset( $_POST[$model->getPk()]);
    //回調(diào)處理post數(shù)據(jù)
    if (method_exists($this, '_tigger_post')) {
        $this->_tigger_post($_POST);
      }
    //reate數(shù)據(jù)
    if(false === $model->create()) {
      $this->error($model->getError());
    }
    //保存當前數(shù)據(jù)對象
    if ($result = $model->add()) { //保存成功
      // 回調(diào)接口
      if (method_exists($this, '_tigger_insert')) {
        $this->_tigger_insert($result);
      }
    }
}