Skip to content

Commit

Permalink
改进php模板输出
Browse files Browse the repository at this point in the history
  • Loading branch information
liu21st committed Jan 6, 2025
1 parent 7a041d4 commit 0bbc21b
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/think/view/driver/Php.php
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,9 @@ private function parseTemplate(string $template): string
if (str_contains($template, '@')) {
// 跨应用调用
[$app, $template] = explode('@', $template);
} elseif ($request->layer()) {
$app = $request->layer();
$controller = $request->controller(true, true);
}

if ($this->config['view_path'] && !isset($app)) {
Expand All @@ -132,7 +135,7 @@ private function parseTemplate(string $template): string

if (!str_starts_with($template, '/')) {
$template = str_replace(['/', ':'], $depr, $template);
$controller = $request->controller();
$controller = $controller ?? $request->controller();
if (str_contains($controller, '.')) {
$pos = strrpos($controller, '.');
$controller = substr($controller, 0, $pos) . '.' . Str::snake(substr($controller, $pos + 1));
Expand Down

0 comments on commit 0bbc21b

Please sign in to comment.