我正在尝试找到一种方法,将 Laravel 表单中输入的值传递到操作页面,但找不到正确的语法。
这是我的刀锋形态的摘录:
{{ Form::open(array('url' => 'thanks')) }}
{{ Form::label('email', 'Email Address') }}
{{ Form::text('email') }}
{{ Form::submit('Sign Up') }}
{{ Form::close() }}
这是我的路线:
Route::post('thanks',function($email)
{
$theEmail = $email;
return View::make('thanks', $theEmail);
});
如何更正路线,以便可以在 thanks.blade.php
页面中使用 $theEmail
?
最佳答案
您需要通过Input::get()从发布的表单中获取变量
Route::post('thanks',function()
{
$theEmail = Input::get('email');
return View::make('thanks')->with('theEmail', $theEmail);
});
关于forms - 将 Laravel 中的表单值传递给 Blade 模板,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23916689/