Laravel 5 - 如何以形式发送url paramaters

时间:2018-06-10 16:40:33

标签: laravel laravel-5.4

我有一个在搜索页面中有一些输入的表单,其中包含一个包含许多参数的URL,我想以这种形式或任何其他方式发送它们。
表格代码

  {!! Form::open(['route' => ['test.mail'],'method' => 'post','files' => true]) !!}
            {!! Form::token() !!}
                    <div class="box-header">
                        <i class="fa fa-envelope"></i>
                        <h3 class="box-title">Quick Email</h3>
                        <!-- tools box -->
                        <div class="pull-right box-tools">
                            <!--<button class="btn btn-info btn-sm" data-widget="remove" data-toggle="tooltip" title="Remove"><i class="fa fa-times"></i></button>-->
                        </div><!-- /. tools -->
                    </div>
                    <div class="box-body">


                        <div class="form-group">
                            <input type="text" class="form-control" name="object" placeholder="Subject" />
                        </div>
                        <div class="form-group">
                            <textarea class="textarea" name="textu" placeholder="Message"  cols="120" rows="8"></textarea>
                        </div>
                         <div class="form-group">
                            <input type="file" class="form-control" name="filee"  />
                        </div>
                    </div>
                    <div class="box-footer clearfix">
                        <input type="submit"  name="sendEmail" class="pull-right btn btn-default" id="sendEmail" value="Send">
                    </div>
                  {!! Form::close() !!}  

2 个答案:

答案 0 :(得分:0)

我希望这会有所帮助,

// Get the current URL without the query string...
echo url()->current();

// Get the current URL including the query string...
echo url()->full();

// Get the full URL for the previous request...
echo url()->previous();

也可以通过URL facade访问这些方法中的每一种:

use Illuminate\Support\Facades\URL;

echo URL::current();

https://laravel.com/docs/5.6/urls

答案 1 :(得分:0)

这是您获取网址中所有值的方式

foreach($_GET as $key=>$value){
    echo $key, ' => ', $value, "<br/>n";
}

然后在表单中发送它们,您只需创建一个隐藏的输入类型:

<input id="someId" name="UrlValue" type="hidden" value="$UrlValue">