no message

This commit is contained in:
hellcat 2026-09-12 18:30:38 +08:00
parent 2ed3e5b808
commit 0792297bb8

View File

@ -8,19 +8,18 @@ class RobotsController extends Controller
{
public function index(): Response
{
$sContent = implode("\n", [
'User-agent: *',
'Allow: /',
'Disallow: /admin/',
'Disallow: /api/',
'Disallow: /storage/',
'Disallow: /vendor/',
'Disallow: /test/',
'Disallow: /*?*',
'Sitemap: ' . config('app.url') . '/sitemap.xml',
]);
$sContent = "User-agent: *\n";
$sContent .= "Allow: /\n";
$sContent .= "Disallow: /admin/\n";
$sContent .= "Disallow: /api/\n";
$sContent .= "Disallow: /storage/\n";
$sContent .= "Disallow: /vendor/\n";
$sContent .= "Disallow: /test/\n";
$sContent .= "Disallow: /*?*\n\n";
$sContent .= "Sitemap: " . config('app.url') . "/sitemap.xml\n";
// 核心修复:强制指定 text/plain 响应头
return response($sContent, 200)
->header('Content-Type', 'text/plain');
->header('Content-Type', 'text/plain; charset=utf-8');
}
}