
SwooleHttpResponse::header 함수의 두 번째 인자로 전달하는 값은 HTTP 헤더의 키입니다. 예를 들어, Content-Type 헤더를 설정하려면 'Content-Type' 값을 전달하면 됩니다.
#hostingforum.kr
php
$response = new SwooleHttpResponse();
$response->header('Content-Type', 'application/json');
이러한 방식으로 HTTP 헤더를 설정할 수 있습니다.
이 외에도 여러 가지 HTTP 헤더를 설정할 수 있습니다.
#hostingforum.kr
php
$response->header('Set-Cookie', 'key=value');
$response->header('Location', 'https://example.com');
$response->header('Cache-Control', 'max-age=3600');
이러한 예제를 통해 SwooleHttpResponse::header 함수의 두 번째 인자의 의미를 이해할 수 있습니다.
2025-05-17 20:42