$format public property
The response format. This determines how to convert $data into $content when the latter is not set. The value of this property must be one of the keys declared in the $formatters array. By default, the following formats are supported:
- FORMAT_RAW: the data will be treated as the response content without any conversion. No extra HTTP header will be added.
- FORMAT_HTML: the data will be treated as the response content without any conversion. The "Content-Type" header will set as "text/html".
- FORMAT_JSON: the data will be converted into JSON format, and the "Content-Type" header will be set as "application/json".
-
FORMAT_JSONP: the data will be converted into JSONP format, and the "Content-Type" header will be set as "text/javascript". Note that in this case
$datamust be an array with "data" and "callback" elements. The former refers to the actual data to be sent, while the latter refers to the name of the JavaScript callback. - FORMAT_XML: the data will be converted into XML format. Please refer to yii\web\XmlResponseFormatter for more details.
You may customize the formatting process or support additional formats by configuring $formatters.
See also $formatters.
Please login to continue.