5
我想獲得更多的時間信息到Symfony Profiler時間軸中,但我無法獲取任何內容。根據我讀過的文檔,它應該和下面的例子一樣簡單,但是這不會在時間線上出現任何額外的信息。Symfony秒錶事件沒有出現在Profiler時間線
我需要以某種方式讓探查器知道我開始和停止的事件嗎?
use Symfony\Component\Stopwatch\Stopwatch;
class DefaultController extends Controller
{
public function testAction()
{
$stopwatch = new Stopwatch();
$stopwatch->start('testController');
usleep(1000000);
$response = new Response(
'<body>Hi</body>',
Response::HTTP_OK,
array('content-type' => 'text/html')
);
$event = $stopwatch->stop('testController');
return $response;
}
}
這個答案應該被接受 – 2017-03-18 07:33:25
他們應該在官方文檔添加此, Stopwatch頁面上沒有提及它。 – Waddles 2017-03-23 05:15:58
@Waddles https://symfony.com/doc/current/components/stopwatch.html – 2017-10-20 11:46:12