redirecting to other methods when calling non-existing methods

后端 未结 3 828
甜味超标
甜味超标 2021-01-14 16:18

If I call $object->showSomething() and the showSomething method doesn\'t exist I get a fata error. That\'s OK.

But I have a show()

3条回答
  •  甜味超标
    2021-01-14 17:11

    Try something like this:

    showStuff();
    $test->showMoreStuff(' and me too');
    $test->showEvenMoreStuff();
    $test->thisDoesNothing();
    

    Output:

    StuffMoreStuff and me tooEvenMoreStuff

提交回复
热议问题