
illustrate
1. It will be automatically called when the static method to be called does not exist or has insufficient permissions.
2. Same as the __call() method, accepting method name and array as parameters.
grammar
__callStatic($funcname, $arguments)
parameter
$funcname String The name of the method called.
$arguments Array Parameters taken when calling the method.
Example
<?php
class autofelix
{
private static function say()
{
echo 'hello, I am autofelix';
}
public function __callStatic($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 use of __callStatic method in php, I hope it will be helpful to everyone.