Yii2在where条件中添加数学

Yii2在where条件中添加数学,yii2,yii2-basic-app,Yii2,Yii2 Basic App,在用户表中,我有一个列调用“month” 我想列出所有符合条件的用户:当前月份-用户月份格式('m'); $users=users::find()->where(['在Yii2中,可以对buil-where条件使用不同的格式 对于这种情况,使用带参数的字符串格式非常有用 在字符串格式中,可以通过这种方式传递文本字符串和参数 $users = Users::find()->where('(month - :today ) <= 2' , [':today'=>$today])-&

在用户表中,我有一个列调用“month”

我想列出所有符合条件的用户:当前月份-用户月份格式('m');
$users=users::find()->where(['在Yii2中,可以对buil-where条件使用不同的格式 对于这种情况,使用带参数的字符串格式非常有用

在字符串格式中,可以通过这种方式传递文本字符串和参数

$users = Users::find()->where('(month - :today ) <= 2' , [':today'=>$today])->all();

$users=users::find()->在哪里('(月-:今天)从字符串中减去整数?
$users = Users::find()->where('(month - :today ) <= 2' , [':today'=>$today])->all();