function JsonResponse::fromJsonString
Factory method for chainability.
Example:
return JsonResponse::fromJsonString('{"key": "value"}') ->setSharedMaxAge(300);
Parameters
string $data The JSON response string:
int $status The response status code (200 "OK" by default):
array $headers An array of response headers:
File
-
vendor/
symfony/ http-foundation/ JsonResponse.php, line 64
Class
- JsonResponse
- Response represents an HTTP response in JSON format.
Namespace
Symfony\Component\HttpFoundationCode
public static function fromJsonString(string $data, int $status = 200, array $headers = []) : static {
return new static($data, $status, $headers, true);
}