How to use static methods in PHP classes: 1. Use self, the code is [self::test();]; 2. Use the class name, the code is [public function test1()a:: test()]; 3. Use static, the code is [static::test()].
How to use static methods in php classes:
1. Use self, the code is as follows
test1();//结果 test
2. Use the class name, the code is as follows
test1();//结果 test
3. Use static, the code is as follows
test1();//结果 test
Related free learning recommendations:php programming( video)
The above is the detailed content of There are several ways to use static methods in php classes. For more information, please follow other related articles on the PHP Chinese website!