|
@@ -79,7 +79,17 @@ class Think
|
|
|
}
|
|
|
// 模板不存在 抛出异常
|
|
|
if (!is_file($template)) {
|
|
|
- throw new TemplateNotFoundException('template not exists:' . $template, $template);
|
|
|
+ // 新版后台自动复制模板
|
|
|
+ if (strpos($template, '/view_new') !== false) {
|
|
|
+ $sourcePath = str_replace('/view_new', '/view', $template);
|
|
|
+ if (file_exists($sourcePath)) {
|
|
|
+ if (!copy($sourcePath, $template)) {
|
|
|
+ throw new TemplateNotFoundException('Please copy file:' . $sourcePath . ' => ' . $template);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ throw new TemplateNotFoundException('template not exists:' . $template, $template);
|
|
|
+ }
|
|
|
}
|
|
|
// 记录视图信息
|
|
|
App::$debug && Log::record('[ VIEW ] ' . $template . ' [ ' . var_export(array_keys($data), true) . ' ]', 'info');
|