嗨我有一個非常簡單的類,實現一個接口。類和接口都在同一個文件中。PHP接口問題 - 類沒有找到
當我實現接口時,我得到一個致命的錯誤「Class not found」,但是當我刪除了implements並嘗試使用該類時,我可以使用它很好嗎?
任何人都可以提供任何意見嗎?
對不起這裏是一些代碼,我使用的時刻來測試:
$tester = new TypeOneTester();
$tester->test("Hello");
interface iTestInterface
{
public function test($data);
}
class TypeOneTester implements iTestInterface
{
public function test($data)
{
return $data;
}
}
任何代碼重現錯誤? – Crozin 2010-09-13 22:20:37
對不起,我現在發佈了一些 – David 2010-09-13 22:25:52
嘗試在文件開始時使用類/接口定義(在使用之前)。 – 2010-09-13 22:28:39