This commit is contained in:
2025-12-31 00:19:29 +08:00
parent 34051feb87
commit 91e0fe8940
12 changed files with 569 additions and 66 deletions
+4 -6
View File
@@ -299,9 +299,7 @@ class BladeCompiler
}
// 替换剩余的 @yield 为空
$layoutContent = preg_replace('/@yield\s*\([\'"](.+?)[\'"]\)/', '', $layoutContent);
return $layoutContent;
return preg_replace('/@yield\s*\([\'"](.+?)[\'"]\)/', '', $layoutContent);
}
// 处理 @section ... @endsection (非继承模式,用于组件等)
@@ -324,9 +322,7 @@ class BladeCompiler
}, $content);
// 处理 @parent(在 section 中使用)
$content = preg_replace('/@parent/', '', $content);
return $content;
return preg_replace('/@parent/', '', $content);
}
/**
@@ -348,6 +344,8 @@ class BladeCompiler
$data = eval("return [{$dataStr}];");
$dataCode = var_export($data, true);
} catch (\Throwable $e) {
\Kiri::getLogger()->json_log($e);
$dataCode = '[]';
}
} else {
+3
View File
@@ -61,6 +61,9 @@ class BladeView
require $compiledPath;
} catch (\Throwable $e) {
ob_end_clean();
\Kiri::getLogger()->json_log($throwable);
throw new \RuntimeException("视图渲染失败: {$this->view}", 0, $e);
}