2015-02-06 113 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{...