0
在php.net有一個例子,我不解地問:混淆與類似的類名的名稱
<?php
namespace foo;
use My\Full\Classname as Another;
// this is the same as use My\Full\NSname as NSname
use My\Full\NSname;
// importing a global class
use ArrayObject;
$obj = new namespace\Another; // instantiates object of class foo\Another
$obj = new Another; // instantiates object of class My\Full\Classname
NSname\subns\func(); // calls function My\Full\NSname\subns\func
$a = new ArrayObject(array(1)); // instantiates object of class ArrayObject
// without the "use ArrayObject" we would instantiate an object of class foo\ArrayObject
?>
從這裏:http://www.php.net/manual/en/language.namespaces.importing.php
他們怎麼能在這個聲明中說$obj = new namespace\Another;
它從類foo\another
實例化一個對象?當我試圖定義添加到類Another
我是說,另一個名字是已經在使用(因爲它是一個別名)的錯誤。