且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

php - yii2的数据操作

更新时间:2023-11-09 21:15:28

/**

  • Updates one or several counter columns for the current AR object.

  • Note that this method differs from [[updateAllCounters()]] in that it only

  • saves counters for the current AR object.
    *

  • An example usage is as follows:
    *

  • $post = Post::findOne($id);

  • $post->updateCounters(['view_count' => 1]);

  • @param array $counters the counters to be updated (attribute name => increment value)

  • Use negative values if you want to decrement the counters.

  • @return boolean whether the saving is successful

  • @see updateAllCounters()
    */