2016年10月17日

php中类和对象的操作

摘要: 在类中用$this指代对象本身。 用self::指代类本身。 $p1 = new Person('michael');//向Person类的构造函数__construct中传名字 echo($p1->name);//获取对象p1的public实例属性name(注意没有$) $p1->speak(); 阅读全文

posted @ 2016-10-17 21:40 Sweet小马 阅读(999) 评论(1) 推荐(1) 编辑

导航