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循环结构 for循环
下一篇:MySQL 日期时间数据类型