Answers for "symfony set content type"

PHP
0

symfony set content type

use Symfony\Component\HttpFoundation\Response;

$response = new Response();
$response->setContent(json_encode([
    'data' => 123,
]));
$response->headers->set('Content-Type', 'application/json');
Posted by: Guest on December-09-2020

Browse Popular Code Answers by Language