2011-07-30 151 views
1

我试图使用晚期静态绑定时出现此错误。所有我可以在谷歌找到关于这个错误的是,人们没有PHP5.3,但我有版本5.3.6。语法错误,意外T_STATIC

有人可以帮我吗?

感谢

class Media 
{ 
    private $nom, 
      $ext; 

    public function ext_autorisees() { return array(); } 

    public function __construct($fichier, $thumb = false) 
    { 
     $fichier = explode(".", $fichier); 

     $nom = $fichier[0]; 
     $ext = $fichier[1]; 

     if(in_array(strtoupper($ext), static::ext_autorisees())) 
     { 
      if(strpos($nom, "thumb_") === 0 && !$thumb) 
       throw new Exception(""); 
     } 
     else 
      throw new Exception(""); 

     $this->nom = $nom; 
     $this->ext = $ext; 
    } 

    public function getNom() { return $this->nom; } 
    public function getExt() { return $this->ext; } 
    public function getPath() { return $this->getNom() . "." . $this->getExt(); } 
    public function getThumb() { return "thumb_" . $this->getPath(); } 

} 
+0

这将运行对我蛮好。什么是错误?你怎么知道你正在运行5.3? –

+0

因为我自己安装它... – Julie

+1

好吧,好奇地,我的目录名为PHP5.3.6,但是当我打电话phpinfo()它告诉我PHP 5.2 ... – Julie

回答

1

有静:: ext_autorisees问题()

+0

你可以使用self :: ext_autorisees() – devtut

+0

不,我有其他的类扩展了那个,我希望他们的ext_autorisees()被调用,而不是这个... – Julie