This commit is contained in:
Your Name
2026-07-22 10:18:59 +08:00
parent 2530ddada6
commit 0fb03d0bca
618 changed files with 19445 additions and 3 deletions
+27
View File
@@ -0,0 +1,27 @@
<?php
namespace app\controller;
use app\BaseController;
class Index extends BaseController
{
public function index()
{
return $this->serveSpa('index.html');
}
private function serveSpa(string $file)
{
$path = rtrim(public_path($file), '/\\');
if (!is_file($path)) {
return response('前端尚未编译,请在项目根目录执行 npm run build', 503, [
'Content-Type' => 'text/plain; charset=utf-8',
]);
}
return response(file_get_contents($path), 200, [
'Content-Type' => 'text/html; charset=utf-8',
]);
}
}