PHP Magic function __call () Usage example analysis, __call instance analysis
This paper analyzes the usage of PHP magic function __call (). Share to everyone for your reference. Specific as follows:
PHP Magic Function __call () Introduction, read the following example to understand:
<?phpclass a{public $name; function test1 ($a) {echo "test1111";} function Test2 ($a) {echo "test2222";}//When an object invokes a method , and when the method does not exist, the system will automatically call the __call () function __call ($method, $val) {echo Class) cannot find the method: ". $method;}} $AAA = new A (); $aaa->test (1);? >
Output Result:
Method not found in class: test
I hope this article is helpful to everyone's PHP programming.
http://www.bkjia.com/PHPjc/958251.html www.bkjia.com true http://www.bkjia.com/PHPjc/958251.html techarticle PHP Magic function __call () Usage example analysis, __call example analysis in this paper the PHP magic function __call () usage. Share to everyone for your reference. The following: PHP Magic function ...