<bdo id='W3u3J'></bdo><ul id='W3u3J'></ul>

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

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

        “返回 $this"是什么意思?意思是?

        时间:2023-10-02
      1. <small id='rSafF'></small><noframes id='rSafF'>

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

                • 本文介绍了“返回 $this"是什么意思?意思是?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  我正在尝试理解这段代码,当我到达最后一行时,我没有理解.:(

                  I'm trying to understand this code, and when I arrived at the final line, I didn't get it. :(

                  我可以请你帮忙看看,return $this 是什么意思?

                  Can I have your help in order to find out, what does return $this mean ?

                  public function setOptions(array $options) {
                      $methods = get_class_methods($this);
                      foreach ($options as $key => $value) {
                          $method = 'set' . ucfirst($key);
                          if (in_array($method, $methods)) {
                              $this->$method($value);
                          }
                      }
                  
                      //???? - return what ?
                      return $this;
                  }
                  

                  更新:
                  为了更好地说明,我删除了我的评论.

                  Update:
                  I've removed my comments for better clarification.

                  推荐答案

                  这种编码方式被称为 流畅的界面.return $this 返回当前对象,所以你可以这样写代码:

                  This way of coding is called fluent interface. return $this returns the current object, so you can write code like this:

                  $object
                    ->function1()
                    ->function2()
                    ->function3()
                    ;
                  

                  代替:

                  $object->function1();
                  $object->function2();
                  $object->function3();
                  

                  这篇关于“返回 $this"是什么意思?意思是?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:Zend 框架:找不到模型类 下一篇:如何调试 MySQL/Doctrine2 查询?

                  相关文章

                  最新文章

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

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

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