Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
可能重复: 如何判断我是静态的还是对象? 如何判断一个函数是否在 PHP 中被静态调用?
我的意思是如果您以这种方式class::method()或以这种方式 调用该方法,$class->method()我怎么知道在同一方法中哪种方式被称为方法?
class::method()
$class->method()
调用方法时不应static与方法混合non-static,但可以检查方法内部是否存在$this。
static
non-static
$this
$staticcalled = isset($this);