search

Home  >  Q&A  >  body text

Small question about $this

Excuse me, this $this ——》How do you type the one behind this this? What is it?

活着活着2639 days ago1195

reply all(3)I'll reply

  • 按键盘手指磨破皮

    按键盘手指磨破皮2017-09-05 23:01:51

    Someone has answered the function and I will answer how to use it. . . This is so simple. In non-input method mode, add the - sign to the right of the + sign on the main keyboard 0 and to the left? The > sign to the left of the key, this > can only be typed by holding down the shift key. To switch between input method mode and letter input mode, just press shift.

    reply
    1
  • ringa_lee

    ringa_lee2017-09-05 17:37:04

    First of all, you need to understand what $this is and what is its role?

    $this is a pointer to the current object. To put it bluntly, it means the previous object. This can realize, for example, class attribute method calls, etc.

    reply
    1
  • 阿布是老黑

    阿布是老黑2017-09-05 16:28:51

    $this->So-and-so method.

    For example

    class man{

    function test1(){

    $this->test2();

    }

    function test2(){

    echo "hello";

    }

    }

    $m = new man();

    $m->test1();

    //Output: hello;


    reply
    1
  • Cancelreply