Home >Backend Development >PHP Tutorial >drupal8怎么redirect到另一个页面上?

drupal8怎么redirect到另一个页面上?

WBOY
WBOYOriginal
2016-06-06 20:29:211295browse

例如我想跳到地址/projects?field_name=xxx,使用D8的API应该怎么写?
D7用drupal_goto就可以了,但drupal8需要知道route name,我又不知道VIEWS的route name是什么。

回复内容:

例如我想跳到地址/projects?field_name=xxx,使用D8的API应该怎么写?
D7用drupal_goto就可以了,但drupal8需要知道route name,我又不知道VIEWS的route name是什么。

找到答案了

<code class="php">use Symfony\Component\HttpFoundation\RedirectResponse;

$response = new RedirectResponse('user/login');
$response->send();</code>
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn