如何使用拉拉维尔中的数据重定向根


How to Redirect the Root with data in Laravel

重定向URL时如何发送数据。

控制器中的代码:

return Redirect::to('cuslist')->with('asdasdadsads', '$values');
如果要

重定向到控制器中的操作,

return Redirect::action('UserController@profile', array('user' => 1));

使用数据重定向的方式是正确的。

with方法将数据切换到会话中。

因此,要访问您在视图中闪烁的数据,请使用Session::get方法。

试试这个

return view('your_view_neme')->with(['first_index'=>$first_value,'second_index'=>$second_value]);
简单地说

,您可以使用以下语法(使用命名参数):

重定向至路由

return Redirect::to('cuslist', array('id' => $id, 'age' => $age));

重定向至命名路由

return Redirect::route('cuslist', array('id' => $id, 'age' => $age));

重定向至"控制器方法"诊断树

return Redirect::action('YourController@yourMethod', array('id' => $id, 'age' => $age));

更多信息请访问:https://laravel.com/docs/4.2/responses#redirects