Laravel 怎么在页面里显示执行时间?
淡淡烟草味
淡淡烟草味 2017-05-16 16:56:03
0
1
860

装了laravel-debugbar,可以统计PHP+SQL的执行时间,很好用。现在有个需求,想在每个页面显示执行时间。搜了一下,没有现成的方案。

laravel-debugbar怎么调用呢?

Laravel Debugbar

https://github.com/barryvdh/laravel-debugbar

This is a package to integrate PHP Debug Bar with Laravel 5. It includes a ServiceProvider to register the debugbar and attach it to the output. You can publish assets and configure it through Laravel. It bootstraps some Collectors to work with Laravel and implements a couple custom DataCollectors, specific for Laravel. It is configured to display Redirects and (jQuery) Ajax Requests. (Shown in a dropdown) Read the documentation for more configuration options.

淡淡烟草味
淡淡烟草味

全部回复(1)
左手右手慢动作

记录 开始/结束 耗时

phpDebugbar::startMeasure('render','Time for rendering');
Debugbar::stopMeasure('render');
Debugbar::addMeasure('now', LARAVEL_START, microtime(true));
Debugbar::measure('My long operation', function() {
    //Do something..
});

热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板
关于我们 免责声明 Sitemap
PHP中文网:公益在线PHP培训,帮助PHP学习者快速成长!