我有一个具有公共静态方法db_log_error()和私有方法_log()的Error类。从静态方法调用私有方法
db_log_error()调用_log()方法。
当我尝试$this->_log()
我得到PHP Fatal error: Using $this when not in object context
当我尝试self::_log()
我得到PHP Strict Standards: Non-static method Error::log() should not be called statically
那么究竟是为了什么,我试图做的最好的方法?
我在静态方法中创建了一个类的实例,它的工作原理,但它似乎不必要的复杂.... – 2012-02-02 16:49:10