$time = new \DateTime('now');
$today = $time->format('Y-m-d');
$programs=Programs::find()->where(['close_date' >= $today])->all();
Run Code Online (Sandbox Code Playgroud)
这是今天close_date大于的程序的代码today's date.我收到错误:
"无效参数-yii\base\InvalidParamException运算符'1'需要两个操作数".
aro*_*hev 10
如果要将where条件写为数组,则代码应如下所示:
$programs = Programs::find()->where(['>=', 'close_date', $today])->all();
Run Code Online (Sandbox Code Playgroud)
查看官方文档了解更多详情:
此外,您可以按如下方式指定任意运算符:条件
['>=', 'id', 10]将导致以下SQL表达式:id >= 10.