【发布时间】:2018-09-24 16:20:04
【问题描述】:
在 Laravel 中使用 route('/index',[],false),通过将第三个参数设置为 url 我们得到相对路径。但是当我使用 Redirect::intended('/dashboard') 那么如何获取相对路径。现在它正在将 /dashboard 添加到 BASE_URL
【问题讨论】:
在 Laravel 中使用 route('/index',[],false),通过将第三个参数设置为 url 我们得到相对路径。但是当我使用 Redirect::intended('/dashboard') 那么如何获取相对路径。现在它正在将 /dashboard 添加到 BASE_URL
【问题讨论】:
Redirects
// Redirect to url
redirect('itsolution');
// Redirect to url with data
redirect('itsolution')->with('key', 'value');
// Redirect to url with input data
redirect('itsolution')->withInput(Input::get());
// Redirect to url with error
redirect('itsolution')->withErrors($validator);
// Redirect to back url
back()->withInput();
// Redirect to route url
redirect()->route('login');
// For a route with the following URI: view/{id}
redirect()->route('view', ['id' => 1]);
// For a route with the following URI: view/{id}/edit/{id_sub}
redirect()->route('profile', [$user]);
// Redirect to controller method
redirect()->action('HomeController@index');
// Redirect to controller method with argument
redirect()->action('UserController@profile', ['id' => 1]);
// Response macro
response()->caps('foo');
// Redirect intend url
redirect()->intended('dashboard');
// Redirect back url
redirect()->back();
【讨论】: