$xml = new \yii\web\XmlResponseFormatter; $xml->rootTag = 'Response'; Yii::$app->response->format = 'custom_xml'; Yii::$app->response->formatters['custom_xml'] = $xml; return ['customer' => ['name' => 'John Smith']];
yii, Executing a SQL without calling a Model <? $connection = Yii :: app () -> db ; $sql = "SELECT id,username FROM users" ; $command = $connection -> createCommand ( $sql ); $dataReader = $command -> query (); $rows = $dataReader -> readAll (); print_r ( $rows ); ?>