yii\web\Controller::asXml PHP 메소드

asXml() 공개 메소드

This method is a shortcut for sending data formatted as XML. It will return the [[Application::getResponse()|response]] application component after configuring the [[Response::$format|format]] and setting the [[Response::$data|data]] that should be formatted. A common usage will be: php return $this->asXml($data);
또한 보기: Response::$format
또한 보기: Response::FORMAT_XML
또한 보기: XmlResponseFormatter
부터: 2.0.11
public asXml ( mixed $data ) : Response
$data mixed the data that should be formatted.
리턴 Response a response that is configured to send `$data` formatted as XML.
    public function asXml($data)
    {
        $response = Yii::$app->getResponse();
        $response->format = Response::FORMAT_XML;
        $response->data = $data;
        return $response;
    }