Fatal error: Cannot access empty property in D:\appServices\AppServ\www\noticeBook\People.php on line 14

解决方案 »

  1.   

    $this->$name;
    改为 $this->name;
      

  2.   

    您的代码应该是成这样:class People{
    #姓名
    private $name ;
    #技能
    private $myslliks ;

    function setName($name){
    $this->name=$name;
    }
    function getName(){//出现致命错误 ------------------------什么原因啊----------------------------
    return $this->name;
    }


    function setMySlliks($myslliks){
    $this->myslliks=$myslliks;
    }
    function getSlliks(){
    return $this->myslliks;
    }
    }$oop = new People();
    $oop->setName("123");
    echo $oop->getName();