[Related learning recommendations: php graphic tutorial】
php method to determine whether it is a static method:
1. Create a new file, create a class, and write a static method, an ordinary method :
<?php class Test { public function wzl(){ echo '我是一个普通方法<br>'; } public static function cwh(){ echo '我是一个静态方法<br>'; } } $class = new Test(); $class->wzl(); $class::cwh();
2. Use the browser to access the file and view the results:
3. If we use the static method access form to access the ordinary method
$class = new Test(); $class::wzl();
The result is as follows:
##4. If we use the access form of ordinary method to access the static method$class = new Test(); $class->cwh();The result is as follows: 5. In addition, it can also be judged through mapping. Edit as follows:
$rm = new ReflectionMethod('Test','wzl'); var_dump($rm->isStatic()); $rm2 = new ReflectionMethod('Test','cwh'); var_dump($rm2->isStatic());
Related learning recommendations:php Programming(Video)