小新新2015

导航

 
<?php

namespace a\b\c;

class Apple {

    function getInfo() {
        echo 'this is a<br>';
    }

}
<?php

namespace d\e\f;

class Apple {

    function getInfo() {
        echo 'this is b<br>';
    }

}
<?php
class Apple {

    function getInfo() {
        echo 'this is C<br>';
    }

}

调用处:

<?php

require_once("A.php");
require_once("B.php");
require_once("C.php");
use a\b\c\Apple;
use d\e\f\Apple as BApple;

$a_app = new Apple();
$a_app->getInfo();

$b_app=new BApple();
$b_app->getInfo();

$c_app=new \Apple();
$c_app->getInfo();

this is a
this is b
this is C

posted on 2016-01-04 22:17  小新新2015  阅读(164)  评论(0编辑  收藏  举报