Skip to content
This repository was archived by the owner on Jan 23, 2019. It is now read-only.

Commit c33170d

Browse files
committed
up
1 parent 4923429 commit c33170d

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

src/Helpers/PhpHelper.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,13 +65,14 @@ public static function runtime($startTime, $startMem, array $info = [])
6565
{
6666
$info['startTime'] = $startTime;
6767
$info['endTime'] = microtime(true);
68+
$info['endMemory'] = memory_get_usage(true);
6869

6970
// 计算运行时间
7071
$info['runtime'] = number_format(($info['endTime'] - $startTime) * 1000, 3) . 'ms';
7172

7273
if ($startMem) {
7374
$startMem = array_sum(explode(' ', $startMem));
74-
$endMem = array_sum(explode(' ', memory_get_usage(true)));
75+
$endMem = array_sum(explode(' ', $info['endMemory']));
7576

7677
$info['memory'] = number_format(($endMem - $startMem) / 1024, 3) . 'kb';
7778
}

src/Web/ViewRenderer.php

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,14 +60,20 @@ public function __construct($viewsPath = null, $layout = null, array $attributes
6060
* throws RuntimeException if view file does not exist
6161
* @param string $view
6262
* @param array $data extract data to view, cannot contain view as a key
63-
* @param string|null $layout override default layout file
63+
* @param string|null|false $layout Override default layout file.
64+
* False - will disable use layout file
6465
* @return string
6566
* @throws \Throwable
6667
*/
6768
public function render($view, array $data = [], $layout = null)
6869
{
6970
$output = $this->fetch($view, $data);
7071

72+
// False - will disable use layout file
73+
if ($layout === false) {
74+
return $output;
75+
}
76+
7177
return $this->renderContent($output, $data, $layout);
7278
}
7379

@@ -297,7 +303,7 @@ protected function getRealView($view)
297303
return $view;
298304
}
299305

300-
return $view . $ext;
306+
return $view . '.' . $ext;
301307
}
302308

303309
/**

0 commit comments

Comments
 (0)