We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
https://github.com/webman-php/log/blob/893917ee574de9bf008eaf24089c61ec843437c7/src/Middleware.php#L194C11-L194C47
$query->bindings[$i] = "'$binding'";
不要直接修改$query->bindings.
$query->bindings
改为如下会好点:
$dispatcher->listen(QueryExecuted::class, function (QueryExecuted $query) { $sql = trim($query->sql); if (strtolower($sql) === 'select 1') { return; } $sql = str_replace("?", "%s", $sql); $bindings = $query->bindings; // <<<<<<<<<<<<<<<<<<<<<<<<<< foreach ($bindings as $i => $binding) { if ($binding instanceof \DateTime) { $bindings[$i] = $binding->format("'Y-m-d H:i:s'"); } else { if (is_string($binding)) { $bindings[$i] = "'$binding'"; } } } $log = $sql; try { $log = vsprintf($sql, $bindings); } catch (\Throwable $e) {} Context::get()->webmanLogs = (Context::get()->webmanLogs ?? '') . "[SQL]\t[connection:{$query->connectionName}] $log [{$query->time} ms]" . PHP_EOL; });
The text was updated successfully, but these errors were encountered:
No branches or pull requests
https://github.com/webman-php/log/blob/893917ee574de9bf008eaf24089c61ec843437c7/src/Middleware.php#L194C11-L194C47
不要直接修改
$query->bindings
.改为如下会好点:
The text was updated successfully, but these errors were encountered: