今日课程:PHP开发-零基础到精通疯狂实战教程(第二季)【韦玮老师】

1、OOP编程概述(面向对象)

2、PHP类和对象实战

/*类的声明class 类名{类中的成员;}修饰词class 类名{类中的成员;}*/class a{	}final class b{//没有子类}

/*属性和方法*/class a{	var $name ;//常规属性	private $heigh;//私有属性	public  $weigh;//公有属性	static $age;//静态属性	function a(){//方法用函数声明	echo "i can eat!
"; } }

/*对象实例化*/$b = new a();$c = new a();final class b{//没有子类}/*访问成员属性*/$b -> name;$b -> name = '11';echo $b -> name,'
';$c -> name;$c -> name = '11';echo $c -> name,'
';