php中的 static 疑惑?
小白
小白 2017-02-24 09:22:55
0
4
927
logic->edu_page->search_page_size; } }


小白
小白

好好学习,天天向上!!!

reply all (4)
钟毅

This is a static class that commhelper has itself and cannot be instantiated. Because this is an object generated in a static function that has been defined in COMMHELPER. Simply put, this function function returns the static function defined in the test parent class. Just think that the things that the parent class has will be there by default. Use it if you want. More convenient to use.

    数据分析师

    Confused about static in php? - PHP Chinese website Q&A - Confused about static in php? - PHP Chinese website Q&A

    Take a look and learn.

      阿神

      首先,你应该先了解static的用法,再去理解你不明白的这段代码的含义。先给你看你一个static使用的例子:

      class zhang{ protected static $name = 'zhangsan'; public static function getName() { echo static::$name; } } class li extends zhang { protected static $name = 'lisi'; } Sedan::getName();

      上面输出的是结果是:lisi;也就是数据当前类的属性。

        迷茫

        如果本类没有的话,那就代表它的父类中的getSharedConfig()静态方法,这里也可以写成self::getSharedConfig(),父类就是extends 的那个类哈

        class father { static public function fatherF(){ echo "我在父类中哦"; } }class oneself extends father{ public function start(){ // return self::fatherF(); return static::fatherF(); // return self::oneselfF(); } static public function oneselfF(){ echo "我在儿子类中哦"; } }echo PHP_VERSION; // 版本$c = new oneself;$c->start();/* +---------------------------------------------------------------------- | 5.6.29 我在父类中哦 +---------------------------------------------------------------------- */
          Latest Downloads
          More>
          Web Effects
          Website Source Code
          Website Materials
          Front End Template
          About us Disclaimer Sitemap
          php.cn:Public welfare online PHP training,Help PHP learners grow quickly!