2015-02-06 156 views
0

我有两个类。在命名空间test \ bout \中进行回合,并在命名空间test \ art中进行艺术处理。PHP扩展类使用命名空间致命错误

namespace test\bout; 
use test\art\Art; 
class Bout extends Art{ 

    function __construct(){ 
     include_once 'Art.php'; 

     echo"boutique "; 
     new Art(); 
    } 
} 
new Bout(); 

而在这之后:

namespace test\art; 
class Art{ 

    function __construct(){ 
     echo "article"; 
    } 
} 

只要我把 “扩展艺术” 我有:致命错误:类 '测试\艺术\艺术' 在/ opt/LAMPP/htdocs目录未找到/test/Boutique.php on line 4

这是否意味着我没有使用“use test \ art \ Art;”正确吗?

THX所有

+3

也许你没有的类加载器或文件夹结构是无效的,不回应你居然*包括 – szapio 2015-02-06 08:43:43

+0

有命名空间*定义'测试\艺术\ Art'文件*之前*'类布特扩展..'? – deceze 2015-02-06 08:49:11

回答

0

我发现吧!

namespace test\bout; 
use test\art\Art; 
**include __DIR__.'/article/Article.php';** 
class Bout extends Art{...