看的视频 __set魔术方法是可以加private属性的
我加了就出现以下错误:Warning: The magic method __set() must have public visibility and cannot be static in D:\wamp\www\index.php on line 15 
王五 

代码如下: 


class demo { 

private $name; 
private $age; 
private $sex; 

function __construct($name,$age,$sex) { 
$this->name=$name; 
$this->age=$age; 
$this->sex=$sex; 


private function __set($proname,$provalue) { 
$this->$proname=$provalue; 


function say() { 
echo $this->name; 




$p1=new demo('张三',38,'男'); 

$p1->name="王五"; 

$p1->say(); 

?> 

是不是php版本问题,我用的是php5.3.3