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

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

WBOY
Release: 2016-06-06 20:29:21
Original
1320 people have browsed it

例如我想跳到地址/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>
Copy after login
Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template