Cake's way is to use RequestHandlerComponent :: replyAs , for example,
$this->RequestHandler->respondAs('xml')somewhere in the controller. This can happen automatically if your application is configured accordingly .
PHP's way is to release header('Content-Type: text/xml')it anywhere before exiting (usually somewhere in the controller).
source
share