2016-12-02 27 views
1

我在用Ratth和Ratth运行到我对命名空间不了解的地方。我已经添加了新的文件,我的应用程序:找不到'MyApp Thread'类

<?php 
namespace MyApp; 

class Test1 extends Thread 
{ 
    public function run() 
    { 
     for ($i = 0; $i < 2; $i++) { 
      sleep(10); 
      echo 1 . date(' H:i:s') . "\n"; 
     } 
    } 
} 

但我搞砸了一些与命名空间,因为我得到这个错误:

PHP Fatal error: Class 'MyApp\Thread' not found in /home/idea/CLI/src/MyApp/Test1.php on line 4 

Fatal error: Class 'MyApp\Thread' not found in /home/idea/CLI/src/MyApp/Test1.php on line 4 

为什么PHP找不到Thread类?它在棘轮之外工作得很好。

+0

你能否包括你的文件夹结构。 – Beginner

+0

但是Thread类来自pthreads,它不在我的项目中。 –

回答