illuminate/database使用whereRaw,webman/console报错

as5739

问题描述

使用whereRaw时,webman/console报错,关闭console后单独sql语句是可行的

程序代码

Db::table('test')->whereRaw( "time > DATE_FORMAT(( CURDATE() - INTERVAL 6 MONTH ), '%Y-%m' )")->get();

//select * from `test` where  time > DATE_FORMAT(( CURDATE() - INTERVAL 6 MONTH ), '%Y-%m' )

报错信息

ValueError: The arguments array must contain 2 items, 0 given in
D:\phpstudy_pro\WWW\energy-consumption\vendor\webman\log\src\Middleware.php:154<br />
Stack trace:<br />
#0 D:\phpstudy_pro\WWW\energy-consumption\vendor\webman\log\src\Middleware.php(154): vsprintf('select * from `...', Array)<br />
#1 D:\phpstudy_pro\WWW\energy-consumption\vendor\illuminate\events\Dispatcher.php(421): Webman\Log\Middleware->Webman\Log\{closure}(Object(Illuminate\Database\Events\QueryExecuted))<br />
#2 D:\phpstudy_pro\WWW\energy-consumption\vendor\illuminate\events\Dispatcher.php(249): Illuminate\Events\Dispatcher->Illuminate\Events\{closure}('Illuminate\\Data...', Array)<br />
#3 D:\phpstudy_pro\WWW\energy-consumption\vendor\illuminate\database\Connection.php(996): Illuminate\Events\Dispatcher->dispatch('Illuminate\\Data...')<br />
#4 D:\phpstudy_pro\WWW\energy-consumption\vendor\illuminate\database\Connection.php(778): Illuminate\Database\Connection->event(Object(Illuminate\Database\Events\QueryExecuted))<br />
#5 D:\phpstudy_pro\WWW\energy-consumption\vendor\illuminate\database\Connection.php(731): Illuminate\Database\Connection->logQuery('select * from `...', Array, 4.32)<br />
#6 D:\phpstudy_pro\WWW\energy-consumption\vendor\illuminate\database\Connection.php(422): Illuminate\Database\Connection->run('select * from `...', Array, Object(Closure))<br />
#7 D:\phpstudy_pro\WWW\energy-consumption\vendor\illuminate\database\Query\Builder.php(2650): Illuminate\Database\Connection->select('select * from `...', Array, true)<br />
#8 D:\phpstudy_pro\WWW\energy-consumption\vendor\illuminate\database\Query\Builder.php(2638): Illuminate\Database\Query\Builder->runSelect()<br />
#9 D:\phpstudy_pro\WWW\energy-consumption\vendor\illuminate\database\Query\Builder.php(3174): Illuminate\Database\Query\Builder->Illuminate\Database\Query\{closure}()<br />
#10 D:\phpstudy_pro\WWW\energy-consumption\vendor\illuminate\database\Query\Builder.php(2639): Illuminate\Database\Query\Builder->onceWithColumns(Array, Object(Closure))<br />
#11 D:\phpstudy_pro\WWW\energy-consumption\app\controller\Index.php(30): Illuminate\Database\Query\Builder->get()<br />
#12 D:\phpstudy_pro\WWW\energy-consumption\vendor\workerman\webman-framework\src\App.php(293): app\controller\Index->test(Object(support\Request))<br />
#13 D:\phpstudy_pro\WWW\energy-consumption\vendor\workerman\webman-framework\src\App.php(317): Webman\App::Webman\{closure}(Object(support\Request))<br />
#14 D:\phpstudy_pro\WWW\energy-consumption\vendor\webman\log\src\Middleware.php(58): Webman\App::Webman\{closure}(Object(support\Request))<br />
#15 D:\phpstudy_pro\WWW\energy-consumption\vendor\workerman\webman-framework\src\App.php(309): Webman\Log\Middleware->process(Object(support\Request), Object(Closure))<br />
#16 D:\phpstudy_pro\WWW\energy-consumption\vendor\workerman\webman-framework\src\App.php(147): Webman\App::Webman\{closure}(Object(support\Request))<br />
#17 D:\phpstudy_pro\WWW\energy-consumption\vendor\workerman\workerman\Connection\TcpConnection.php(638): Webman\App->onMessage(Object(Workerman\Connection\TcpConnection), Object(support\Request))<br />
#18 D:\phpstudy_pro\WWW\energy-consumption\vendor\workerman\workerman\Events\Select.php(311): Workerman\Connection\TcpConnection->baseRead(Resource id #263)<br />
#19 D:\phpstudy_pro\WWW\energy-consumption\vendor\workerman\workerman\Worker.php(2467): Workerman\Events\Select->loop()<br />
#20 D:\phpstudy_pro\WWW\energy-consumption\vendor\workerman\workerman\Worker.php(1453): Workerman\Worker->run()<br />
#21 D:\phpstudy_pro\WWW\energy-consumption\vendor\workerman\workerman\Worker.php(1396): Workerman\Worker::forkWorkersForWindows()<br />
#22 D:\phpstudy_pro\WWW\energy-consumption\vendor\workerman\workerman\Worker.php(560): Workerman\Worker::forkWorkers()<br />
#23 D:\phpstudy_pro\WWW\energy-consumption\vendor\workerman\webman-framework\src\support\App.php(124): Workerman\Worker::runAll()<br />
#24 D:\phpstudy_pro\WWW\energy-consumption\start.php(4): support\App::run()<br />
#25 {main}

截图报错信息里报错文件相关代码

操作系统及workerman/webman等框架组件具体版本

"workerman/webman-framework": "^1.4.3",
"illuminate/database": "^9.34",
"webman/log": "^1.1",

967 1 0
1个回答

walkor 打赏

执行 composer require webman/log ^v1.1.3 升级下webman/log插件

年代过于久远,无法发表回答
×
🔝