Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/250.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 如何处理和限制在laravel项目上执行的查询数量?_Php_Laravel - Fatal编程技术网

Php 如何处理和限制在laravel项目上执行的查询数量?

Php 如何处理和限制在laravel项目上执行的查询数量?,php,laravel,Php,Laravel,如何可视化执行的查询数量以及如何最小化这些查询以提高系统性能如果您想知道哪些查询被发送到数据库,可以使用以下两种解决方案: 如果您正在寻找影响性能的因素,可以使用以下两条指令来确定代码的正确行: $time = microtime(true); // we save the precise time in milliseconds // some lines of code dd(microtime(true) - $time); // prints the milliseconds spent

如何可视化执行的查询数量以及如何最小化这些查询以提高系统性能

如果您想知道哪些查询被发送到数据库,可以使用以下两种解决方案:

如果您正在寻找影响性能的因素,可以使用以下两条指令来确定代码的正确行:

$time = microtime(true); // we save the precise time in milliseconds
// some lines of code
dd(microtime(true) - $time); // prints the milliseconds spent since $time was saved

如果有帮助,请告诉我

我需要一些澄清。您想限制查询的数量还是结果的数量?大多数情况下,最好与您的MySQL/MSSQL/一起检查查询。。。疑难解答工具。我想限制发送到数据库的查询数量谢谢,laravel debugba工作得很好。。。现在,我可以可视化在触发与数据库通信的某些事件的页面呈现时执行的查询。。我仍在想如何减少问题的数量你还需要别的什么,还是它能完全回答你的问题?