[ 'header' => 'Accept-Language: zh-CN' ] ]); $url = 'http://localhost:8000/api/gate/visits'; $response = @file_get_contents($url, false, $context); if ($response !== false) { echo "✅ 中文语言支持正常\n"; } else { echo "❌ 中文语言支持异常\n"; } // 测试英文响应 $context = stream_context_create([ 'http' => [ 'header' => 'Accept-Language: en' ] ]); $response = @file_get_contents($url, false, $context); if ($response !== false) { echo "✅ 英文语言支持正常\n"; } else { echo "❌ 英文语言支持异常\n"; } // 测试后台管理接口 echo "\n3. 测试后台管理接口:\n"; $url = 'http://localhost:8000/api/admin/visits/index'; $response = @file_get_contents($url); if ($response !== false) { $data = json_decode($response, true); if (isset($data['code']) && $data['code'] == 401) { echo "✅ GET /api/admin/visits/index - 认证保护正常\n"; } else { echo "⚠️ GET /api/admin/visits/index - 认证保护可能有问题\n"; } } else { echo "❌ GET /api/admin/visits/index - 接口无法访问\n"; } echo "\n=== 测试完成 ===\n"; echo "注意: 此测试需要Laravel开发服务器运行在 localhost:8000\n"; echo "启动命令: php artisan serve\n";