我对命名空间和use
语句有点困惑。
我有三个文件:ShapeInterface.php
,Shape.php
和Circle.php
。
我试图使用相对路径来实现,所以我在所有类中都加入了以下内容:
namespace Shape;
在我的圆形类中,我有以下内容:
namespace Shape;
//use Shape;
//use ShapeInterface;
include 'Shape.php';
include 'ShapeInterface.php';
class Circle extends Shape implements ShapeInterface{ ....
如果我使用include
语句,就不会出现错误。但如果我尝试使用use
语句,就会出现以下错误:
请问是否有人能够为我提供一点指导?致命错误:类'Shape\Shape'未在 /Users/shawn/Documents/work/sites/workspace/shape/Circle.php的第8行找到