这篇文章将为大家详细讲解有关php中static如何延时对象绑定,小编觉得挺实用的,因此分享给大家做个参考,希望大家阅读完这篇文章后可以有所收获。
php static 延时对象绑定
static表示当前对象多属的类
static两个作用:表示静态的和当前类名
class Person { public static $type ='人类'; public function show1() { //var_dump($this); //学生对象 //echo self::$type; //人类 echo static::type; //学生 } } class Student extends Person{ public static $type ='学生'; public function show2() { //var_dump($this); //学生对象 //echo self::$type; //学生 echo static::type; //学生 } }
关于“php中static如何延时对象绑定”这篇文章就分享到这里了,希望以上内容可以对大家有一定的帮助,使各位可以学到更多知识,如果觉得文章不错,请把它分享出去让更多的人看到。