开发者

What to use istead of THIS in php OOP?

I have a static class that loads additional php file inside of one of its function and I need to access class variables from this file withous knowing the class name.

But This::SomeVar - doesn't work.

But I know there's another way to do it, I just can't find anything ab开发者_JAVA技巧out it.

So here's the example class

class SomeClass {
    static function Initialize() {
        require_once 'somefile.php';
    }
}

and inside that file I need to access static variable something like this

This::SomeVar= 'qwe';


Use self::$SomeVar to access static class members.


$this->someVar for fields and self::$someVar for statics


You can use $this->someVar to access a property from inside a class.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜