我试图在 Symfony 中 x 秒后进行 PHP 标头重定向,如下所示:
header( "refresh:5;url=http://www.something.com" );
我怎样才能在 Symfony2 中做到这一点?
根据doc http://symfony.com/doc/current/book/http_fundamentals.html#requests-and-responses-in-symfony一定是这样的:
$response = new Response();
$response->setStatusCode(200);
$response->headers->set('Refresh', '5; url=http://www.something.com/');
$response->send();
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)