
illustrate
1. When the method to be called does not exist or has insufficient permissions, it will be called automatically.
2. First, rewrite the __call method. The __call method has two parameters, method and param, which correspond to the real method name and parameters.
Application scenarios
This method can be used when a unified calling method is needed but there are many interfaces.
Example
<?php
class autofelix
{
private function say()
{
echo 'hello, I am autofelix';
}
public function __call($name, $arguments)
{
echo 'You do not have permission to call' . $name . 'Method';
die;
}
}
$a = new autofelix();
$a->say(); //It stands to reason that an error should be reported
//Output: you do not have the right to call the say methodThe above is the usage of __call method in php. I hope it will be helpful to everyone.