symfony request

117

use Symfony\Component\HttpFoundation\Response;

$response = new Response();
$response->setContent(json_encode([
    'data' => 123,
]));
$response->headers->set('Content-Type', 'application/json');
public function myAction(Request $request)
{
    if ($request->isMethod('POST')) {
    }
}

Comments

Submit
0 Comments