ZF2에서 헤더를 설정하는 데 문제가 있습니다. 내 코드는 다음과 같습니다.ZF2 - 헤더를 올바르게 설정하는 방법은 무엇입니까?
public function xmlAction()
{
$headers = new \Zend\Http\Headers();
$headers->clearHeaders();
$headers->addHeaderLine('Content-type', 'application/xml');
echo $file; // xml file content
exit;
}
하지만 헤더는 여전히 text/html입니다. 적절한 헤더를 다음과 같이 설정할 수 있습니다 :
header("Content-type: application/xml");
하지만 젠드 프레임 워크로하고 싶습니다. 왜 위 코드가 작동하지 않습니까?
아니요, 여전히 유감 스럽습니다. – b4rt3kk