时间:2021-07-01 10:21:17 帮助过:24人阅读
$bytes = memory_get_peak_usage();
function formatBytes($bytes, $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));
return round($bytes, $precision) . " " . $units[$pow];
}
echo formatBytes($bytes);【推荐课程:PHP视频教程】
以上就是php 查看使用了多少内存的详细内容,更多请关注Gxlcms其它相关文章!