The problem of using mysql time function in thinkphp5 Array query method

the time query is mentioned separately on the document, and after a general look, it is queried using the built-in method

.

this bothers me a lot when I use arrays to assemble query conditions.

my query conditions look like this:

$whereMap = [
["name","="," Zhang San"],
.
];

now I need to query the data of a certain day, or a certain year, and find that I can"t assemble it with an array.
$whereMap = [
["YEAR (filedName)","=", "2014"]
.
];

this kind of error report, check the source code, it seems that here key direct regular match threw an exception.

can only use strings to query conditions, or concatenate multiple-> where ()?

Jan.20,2022

follow the way tp5 copies Laravel. You should be able to use

directly in where.
DB::raw ('native statement')

or

whereRaw ('native statement')
Menu