3
votes

How can i write ["Content-Type"] = "text/xml" in cakephp and in which file i have to include that one.

Please Help.

Thanks.

1
are you trying to set a header? - Dan Heberden
ya i am trying to set the Header for my page - rajesh

1 Answers

5
votes

The Cake way is to use RequestHandlerComponent::respondAs, like
$this->RequestHandler->respondAs('xml'), somewhere in the controller. This may even happen automatically if your app is set up appropriately.

The PHP way is to issue header('Content-Type: text/xml') anywhere before any output (usually somewhere in the controller).