1. First to clarify some points of view
Since the static method has only one copy in memory, no matter how many times you call it, it is common, and there is no concept of object, so you cannot use the $this call in a static method, and if you have to invoke it, you can only instantiate your own class
And instantiation is not the same, each instantiation is an object, in memory is multiple
<?PHPerror_reporting(E_all|e_strict);classa{ Public functionBar () {Echo' Bar '.Php_eol; } Public Static functionfoo () {Echo' foo '.Php_eol; }}a::bar ();//Will error a:: foo ();//correct
$obj = new A ();
$obj foo ();//correct
Strict Standards:non-static Method Human::easyeat () should not being called statically in ....
However, a class that is instantiated can call a static method.
*/
<?PHPclassa{ Public $name= ' Zongshuai '; Public functionBar () {Echo' Bar '.Php_eol; } Public Static functionfoo () {EchoSelf::$name.Php_eol;//Error}} A:: foo ();/*A static method cannot invoke a non-static property. You cannot use Self:: Call a non-static property. */
Class Access--general method (object method)--not (although the method is not $this keyword, you can!) But this is not supported.)
Object Access General methods (methods of objects), you can
About the difference between a php static method call and an instantiated class call