<?php
    class xx{
       private $gg=30;
       function __get($cute){
           return $this->$cute;
       }
       function __set($n,$val){
           $this->$n=$val;
       }
    }
    $xxx=new xx();
    echo $xxx->gg;
?>真要获取$gg你把$gg设置为public不就完了?