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')
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b39ab3-2c1c8.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b39ab3-2c1c8.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?