2012-12-07 27 views
-2

我嘗試父功能,但我得到這個錯誤:意想不到的 '靜態'(T_STATIC),預計標識符(T_STRING)

unexpected 'static' (T_STATIC), expecting identifier (T_STRING) 

我有PHP v5.4.7 這裏是代碼

public function static tableExist($table, $db) 
    { 
     $tables = mysql_exists($db); 
      while(list($temp) = mysql_fetch_array($name, $pass)) 
      { 
       if($temp = $table) 
       { 
        return TRUE; 
       } 
       else 
       { 
        return FALSE; 
       } 
      } 

    } 

和使用

if(register::tableExist(users, webshop)); 
       { 
        echo "succes"; 
       } 
+3

'公共靜態函數' – Mike

+0

您可能希望參考[OOP上的PHP手冊](http://php.net/language.oop5)以瞭解將來的語法問題。 – Charles

+0

我刪除了OOP標籤,因爲當你開始使用'static'時,它實際上不是OOP。僅僅因爲你正在使用類,並不會使它成爲OOP。 – PeeHaa

回答

1

嘗試public static function tableExist

編輯:你有具體的線參考?

+0

public function static tableExist($ table,$ db) – Hangslotman

+0

然後如上所述,'public static function'就是你想要的。 – bear

+0

@Hangslotman這是合適的答案。你錯誤地定義你的方法。 – SaidbakR

相關問題