如何在cakephp中编写内容类型?

raj*_*esh 3 php content-type cakephp header http

我如何在cakephp中编写["Content-Type"] ="text/xml"以及我必须包含该文件的文件.

请帮忙.

谢谢.

dec*_*eze 5

Cake方法是使用RequestHandlerComponent :: respondAs,比如
$this->RequestHandler->respondAs('xml')控制器中的某个地方.如果您的应用设置得当,这甚至可能会自动发生.

PHP的方式是header('Content-Type: text/xml')在任何输出之前发出任何地方(通常在控制器的某个地方).