2014-04-02 2 views
0

내가 이해하지 않았다 예를 들어이 foo\another 클래스의 객체를 인스턴스화합니다. Another 클래스에 정의를 추가하려고하면 다른 이름이 이미 사용 중임을 알리는 오류가 발생합니다 (별칭이기 때문에).앨리어싱 php.net에서

답변

0

foo\Another 클래스가 별칭없이 다른 파일에 정의 된 경우에 작동합니다.

another.php

<?php 

namespace foo; 

class Another { } 

test.php

<?php 

namespace foo; 
use My\Full\Classname as Another; 

require_once 'another.php'; 

new namespace\Another; 

주어진 예제는 네임 스페이스 해상도를 설명하는 것입니다 편리 기타 세부 사항 및 발생할 수있는 충돌을 무시합니다.