<tfoot id='JqalX'></tfoot>

    <small id='JqalX'></small><noframes id='JqalX'>

  • <i id='JqalX'><tr id='JqalX'><dt id='JqalX'><q id='JqalX'><span id='JqalX'><b id='JqalX'><form id='JqalX'><ins id='JqalX'></ins><ul id='JqalX'></ul><sub id='JqalX'></sub></form><legend id='JqalX'></legend><bdo id='JqalX'><pre id='JqalX'><center id='JqalX'></center></pre></bdo></b><th id='JqalX'></th></span></q></dt></tr></i><div id='JqalX'><tfoot id='JqalX'></tfoot><dl id='JqalX'><fieldset id='JqalX'></fieldset></dl></div>
        <bdo id='JqalX'></bdo><ul id='JqalX'></ul>

    1. <legend id='JqalX'><style id='JqalX'><dir id='JqalX'><q id='JqalX'></q></dir></style></legend>

        动态创建 Laravel Request 对象

        Create a Laravel Request object on the fly(动态创建 Laravel Request 对象)
      1. <legend id='I70v6'><style id='I70v6'><dir id='I70v6'><q id='I70v6'></q></dir></style></legend>

        <i id='I70v6'><tr id='I70v6'><dt id='I70v6'><q id='I70v6'><span id='I70v6'><b id='I70v6'><form id='I70v6'><ins id='I70v6'></ins><ul id='I70v6'></ul><sub id='I70v6'></sub></form><legend id='I70v6'></legend><bdo id='I70v6'><pre id='I70v6'><center id='I70v6'></center></pre></bdo></b><th id='I70v6'></th></span></q></dt></tr></i><div id='I70v6'><tfoot id='I70v6'></tfoot><dl id='I70v6'><fieldset id='I70v6'></fieldset></dl></div>

        <small id='I70v6'></small><noframes id='I70v6'>

            <tbody id='I70v6'></tbody>
          <tfoot id='I70v6'></tfoot>
            • <bdo id='I70v6'></bdo><ul id='I70v6'></ul>

                1. 本文介绍了动态创建 Laravel Request 对象的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我正在一个控制器中处理数据,并希望将其进一步传递到另一个控制器中以避免重复代码.

                  有没有办法设置另一个控制器的 store 方法中需要的 Request 对象?我已经追踪了 Request 继承并找到了 Symfony 的 Request 对象,它有一个 request 属性,它实际上是一个 ParameterBag ,它包含一个方法 add> 添加带有值的参数.

                  我尝试了以下方法,但结果是 null:

                  $myRequest = new Request();$myRequest->request->add(['foo' =>'bar']);var_dump($myRequest->foo);

                  我正在为这个项目使用 Laravel 5.1.

                  解决方案

                  你可以使用replace():

                  $request = new IlluminateHttpRequest();$request->replace(['foo' =>'bar']);dd($request->foo);

                  或者,为第二个控制器中发生的任何事情创建一个 Job 并删除 ShouldQueue 接口以使其同步运行会更有意义.>

                  希望这有帮助!

                  I'm handling data in one controller and want to pass it further into another controller to avoid duplicate code.

                  Is there a way to set up a Request object that is needed in the other controller's store-method? I've traced down the Request inheritance and came to Symfony's Request object which has a request property that is in fact a ParameterBag that holds a method add to add parameters with values to it.

                  I've tried the following but I'm getting null as result:

                  $myRequest = new Request();
                  $myRequest->request->add(['foo' => 'bar']);
                  var_dump($myRequest->foo);
                  

                  I'm on Laravel 5.1 for this project.

                  解决方案

                  You can use replace():

                  $request = new IlluminateHttpRequest();
                  
                  $request->replace(['foo' => 'bar']);
                  
                  dd($request->foo);
                  

                  Alternatively, it would make more sense to create a Job for whatever is going on in your second controller and remove the ShouldQueue interface to make it run synchronously.

                  Hope this helps!

                  这篇关于动态创建 Laravel Request 对象的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  DeepL的翻译效果还是很强大的,如果我们要用php实现DeepL翻译调用,该怎么办呢?以下是代码示例,希望能够帮到需要的朋友。 在这里需要注意,这个DeepL的账户和api申请比较难,不支持中国大陆申请,需要拥有香港或者海外信用卡才行,没账号的话,目前某宝可以
                  PHP通过phpspreadsheet导入Excel日期,导入系统后,全部变为了4开头的几位数字,这是为什么呢?原因很简单,将Excel的时间设置问文本,我们就能看到该日期本来的数值,上图对应的数值为: 要怎么解决呢?进行数据转换就行,这里可以封装方法,或者用第三方的
                  mediatemple - can#39;t send email using codeigniter(mediatemple - 无法使用 codeigniter 发送电子邮件)
                  Laravel Gmail Configuration Error(Laravel Gmail 配置错误)
                  Problem with using PHPMailer for SMTP(将 PHPMailer 用于 SMTP 的问题)
                  Issue on how to setup SMTP using PHPMailer in GoDaddy server(关于如何在 GoDaddy 服务器中使用 PHPMailer 设置 SMTP 的问题)
                  • <legend id='7rFoT'><style id='7rFoT'><dir id='7rFoT'><q id='7rFoT'></q></dir></style></legend>

                      • <bdo id='7rFoT'></bdo><ul id='7rFoT'></ul>

                          <small id='7rFoT'></small><noframes id='7rFoT'>

                          <i id='7rFoT'><tr id='7rFoT'><dt id='7rFoT'><q id='7rFoT'><span id='7rFoT'><b id='7rFoT'><form id='7rFoT'><ins id='7rFoT'></ins><ul id='7rFoT'></ul><sub id='7rFoT'></sub></form><legend id='7rFoT'></legend><bdo id='7rFoT'><pre id='7rFoT'><center id='7rFoT'></center></pre></bdo></b><th id='7rFoT'></th></span></q></dt></tr></i><div id='7rFoT'><tfoot id='7rFoT'></tfoot><dl id='7rFoT'><fieldset id='7rFoT'></fieldset></dl></div>
                              <tbody id='7rFoT'></tbody>

                            <tfoot id='7rFoT'></tfoot>