扫码关注官方订阅号
请问各位YII2中有没有一个方法是跟TP框架里的setInc和setDec相同的功能
ringa_lee
/**
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()*/
微信扫码关注PHP中文网服务号
QQ扫码加入技术交流群
扫描下载App
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
PHP学习
技术支持
返回顶部
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()
*/