getAcceptableContentTypes() public method
Returns the content types acceptable by the end user.
This is determined by the Accept
HTTP header. For example,
$_SERVER['HTTP_ACCEPT'] = 'text/plain; q=0.5, application/json; version=1.0, application/xml; version=2.0;'; $types = $request->getAcceptableContentTypes(); print_r($types); // displays: // [ // 'application/json' => ['q' => 1, 'version' => '1.0'], // 'application/xml' => ['q' => 1, 'version' => '2.0'], // 'text/plain' => ['q' => 0.5], // ]
public array getAcceptableContentTypes ( ) | ||
---|---|---|
return | array |
The content types ordered by the quality score. Types with the highest scores will be returned first. The array keys are the content types, while the array values are the corresponding quality score and other parameters as given in the header. |
Please login to continue.