$bytes = memory_get_peak_usage();
$precision = 2;
$units = array("b", "kb", "mb", "gb", "tb");
$bytes = max($bytes, 0);
$pow = floor(($bytes ? log($bytes) : 0) / log(1024));
$pow = min($pow, count($units) - 1);
$bytes /= (1 << (10 * $pow));
$size = round($bytes, $precision) . " " . $units[$pow];
php 运行内存
最新推荐文章于 2023-05-18 00:02:13 发布