在新窗口中返回响应

M4x*_*ell 1 response target symfony

如何在新窗口中返回响应对象?我的意思是,我需要响应html页面,但在新窗口中像目标空白一样.

    $response = new Response($html);
    $response->setStatusCode(200); 
    return $response; 
Run Code Online (Sandbox Code Playgroud)

上面的代码返回html页面,但在同一个选项卡中.

Seh*_*ael 6

Symfony没有处理这个问题.这由客户端功能(目标)处理.最好的办法是在新窗口中打开操作的触发器.因此,如果您的触发器是一个链接,您可以执行以下操作:

<a href="{{ path('yourRoute') }}" target="_blank">Open in new window</a> 
Run Code Online (Sandbox Code Playgroud)