转载:http://wyllife.blog.163.com/blog/static/4116390120116223528180/
在php中常见的对象符号
this是指向当前对象的指针(可以看成C里面的指针)
而且this的使用同所有的php变量一样,使用时前面必须带$
2. ->
这个箭头是配合$this使用的,是php中普通对象访问对象的属性和方法的方式
如:
1 <?php 2 class Test{ 3 public $a; 4 5 public function __construct(){ 6 } 7 } 8 9 //调用 10 $test = new Test(); 11 /*对象访问public属性是,不用在变量前加美元符号*/ 12 $test->a;//看到吗,这里不是$a哦,这个要特别注意 13 ?>