我需要获取输入值以在下方使用,该怎么做? 我试着喜欢这个,但错误说
Undefined variable: name
<div class="col-md-10 col-md-offset-1">
<input id="name" type="text" name="name" />
</div>
<div class="col-md-10 col-md-offset-1">
@php
$nameValue=$_GET['name'];
@endphp
<input id="name2" type="text" name="name2" value="{{$nameValue}}" />
</div>
最佳答案
$nameValue=Request::input('name')
从 Blade 模板中,您可以使用 Request
facade 访问请求参数,您也可以直接打印它:
{{Request::input('name')}}
在最新版本中,您还可以使用:
{{request()->input('name')}}
关于php - 如何在 blade.php 中获取输入值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48263263/