📜  symfony 设置内容类型 - PHP 代码示例

📅  最后修改于: 2022-03-11 14:54:04.305000             🧑  作者: Mango

代码示例1
use Symfony\Component\HttpFoundation\Response;

$response = new Response();
$response->setContent(json_encode([
    'data' => 123,
]));
$response->headers->set('Content-Type', 'application/json');