Laravel 怎麼在頁面顯示執行時間?
淡淡烟草味
淡淡烟草味 2017-05-16 16:56:03
0
1
899

裝了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 Collector 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..
});

熱門教學
更多>
最新下載
更多>
網站特效
網站源碼
網站素材
前端模板