标题位置在 Laravel 5.2 中不起作用

use*_*576 1 php laravel

我不知道 Laravel 发生了什么。使用 php 中的 Header 位置不起作用。

$d = "http://www.google.com";
header('Location: '.$d);
Run Code Online (Sandbox Code Playgroud)

如果我在本地使用Redirect::to(),则不会发生任何事情。我需要在 Laravel 5.2 中首先设置什么吗?

Kma*_*rYC 5

Laravel 5.2 中。你应该这样做

redirect()->to('url')->send();
Run Code Online (Sandbox Code Playgroud)

或者

return redirect()->to('url');
Run Code Online (Sandbox Code Playgroud)