摘要: class test { private $a = 1; public static function say() { $test = new test(); echo $test->a; } } $test = new test(); $test->say(); // 打印为1,类中定义实例,实例是可以访问私有变量的 echo $test->a; // 报错以前这个用法很少接触,今天看JAVA的时候,JAVA语法也是这样,所以才回来测试下PHP。他们是相同的,对象如果... 阅读全文
posted @ 2013-08-16 10:33 hinson0 阅读(572) 评论(0) 推荐(0)