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

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

        laravel compact() 和 -&gt;with()

        laravel compact() and -gt;with()(laravel compact() 和 -gt;with())

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

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

            1. <legend id='7r0mh'><style id='7r0mh'><dir id='7r0mh'><q id='7r0mh'></q></dir></style></legend>
            2. <tfoot id='7r0mh'></tfoot>
                • <bdo id='7r0mh'></bdo><ul id='7r0mh'></ul>
                    <tbody id='7r0mh'></tbody>
                  本文介绍了laravel compact() 和 -&gt;with()的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我有一段代码,我试图找出为什么一个变体有效而另一个无效.

                  I have a piece of code and I'm trying to find out why one variation works and the other doesn't.

                  return View::make('gameworlds.mygame', compact('fixtures'), compact('teams'))->with('selections', $selections);
                  

                  这让我可以按预期生成赛程、球队和选择的数组视图.

                  This allows me to generate a view of arrays for fixtures, teams and selections as expected.

                  然而,

                  return View::make('gameworlds.mygame', compact('fixtures'), compact('teams'), compact('selections'));
                  

                  不允许正确生成视图.我仍然可以回显数组并获得预期的结果,但视图在到达选择部分后不会呈现.

                  does not allow the view to be generated properly. I can still echo out the arrays and I get the expected results but the view does not render once it arrives at the selections section.

                  没关系,因为我让它使用 ->with() 语法,但只是一个奇怪的语法.

                  It's oké, because I have it working with the ->with() syntax but just an odd one.

                  谢谢.搜索引擎

                  推荐答案

                  View::make 函数采用 3 个参数,根据文档是:

                  The View::make function takes 3 arguments which according to the documentation are:

                  public View make(string $view, array $data = array(), array $mergeData = array())
                  

                  在您的情况下, compact('selections')4th 参数.它不会传递给视图,并且 laravel 会抛出异常.

                  In your case, the compact('selections') is a 4th argument. It doesn't pass to the view and laravel throws an exception.

                  另一方面,您可以使用 with() 任意次数.因此,这将起作用:

                  On the other hand, you can use with() as many time as you like. Thus, this will work:

                  return View::make('gameworlds.mygame')
                  
                  ->with(compact('fixtures'))
                  
                  ->with(compact('teams'))
                  
                  ->with(compact('selections'));
                  

                  这篇关于laravel compact() 和 -&gt;with()的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

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

                  相关文档推荐

                  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 的问题)
                  • <small id='fp24l'></small><noframes id='fp24l'>

                      <tbody id='fp24l'></tbody>
                    <tfoot id='fp24l'></tfoot>

                    <legend id='fp24l'><style id='fp24l'><dir id='fp24l'><q id='fp24l'></q></dir></style></legend>
                        <bdo id='fp24l'></bdo><ul id='fp24l'></ul>

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