php static 延时对象绑定

php static 延时对象绑定

php编程知识qingyu2020-11-07 8:06:35961A+A-

  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;  //学生
	}
}


点击这里复制本文地址 欢迎来到大黄鸡源码分享网
qrcode

大黄鸡源码编程网 © All Rights Reserved.  
网站备案号:闽ICP备18012015号-4
Powered by Z-BlogPHP
联系我们| 关于我们| 广告联系| 网站管理