The member method does not exist when the Magic method is automatically called, PHP does not support polymorphism, can be implemented by call pseudo polymorphic.
<?
Class a{
Function Show () {
Echo 1;
}
function call ($f, $args) {
echo "__call";
}
}
$obj = new A;
$obj->k ();
?>
Output __call
That is, when an object is instantiated, its member method is called directly when the member method of the object is called, but when the member method does not exist, the call method is called instead.
At the same time call must have two parameters, this parameter name can be arbitrarily taken, but for convenience we usually take as $name and $args
When the member method does not exist, call is called, and the non-existent method name is passed as a string to the first argument (where the first argument is $name), and the argument passed as the invocation is passed as a list to the second parameter (here the second argument is $args).
PHP Magic Method __call