php类命名空间问题

时间:2016-05-01 20:14:20

标签: php class

我在php文档中找到了我需要的部分,但是遇到了问题 PHP documentation

检查例3

我的代码

namespace Test;
class Test{
    public function __construct() {
        echo 1;

    }
}

use Test\Test as Test;
$a = 'Test';
new $a;
  

致命错误:未捕获错误:

中未找到类'测试'

PS。当我用new Test创建时,一切正常

版本PHP 7.0.4

0 个答案:

没有答案