laravel5.2中
$select[] = DB::raw('date_format(from_unixtime(created_at),"%Y-%m") as month');
MyModel:get($select);
会提示vsprintf(): Too few arguments的错误
原因在于vsprintf会认为%Y-%m这个是需要替换的参数,但是参数并没有传递给它,所以显示“参数不够”的错误
但是,这应该怎么解决
...全文
9504打赏收藏
laravel查询构造器使用from_unixtime
laravel5.2中 $select[] = DB::raw('date_format(from_unixtime(created_at),"%Y-%m") as month'); MyModel:get($select); 会提示vsprintf(): Too few arguments的错误 原因在于vsprintf会认为%Y-%m这个是需要替换的参数,但是参数并没有传递给它,所以显示“参数不够”的错误 但是,这应该怎么解决