Drupal 8 性能分析之统计运行时间

Submitted by admin on Fri, 10/08/2021 - 12:18
use Drupal\Component\Utility\Timer;
Timer::start('test');
$file = file_get_contents('/var/www/html/web/sites/default/files/2020-11/timg.jpg');
dpm($file);
$base = base64_encode($file);
sleep(1);
$time = Timer::read('test');
dpm($time);
dpm($base);