在laravel中测试查询执行时间 [英] Test query execution time in laravel

查看:1091
本文介绍了在laravel中测试查询执行时间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在laravel/phpunit中测试执行查询需要花费多长时间?

How to test in laravel/phpunit how long query took to execute?

是否有可能使其不依赖于其他事物?

Is it possible so that it does not depend on something else?

推荐答案

最早的方法是最好的方法:

The oldest way is the best one:

$start = microtime(true);
// Execute the query
$time = microtime(true) - $start;

这篇关于在laravel中测试查询执行时间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆