实例化错误 - 名称已被使用

时间:2015-01-29 13:58:00

标签: php class object

我正在使用库并实例化对象:

use \DTS\eBaySDK\Constants;
use \DTS\eBaySDK\Finding\Services;
use \DTS\eBaySDK\Finding\Types;

use \DTS\eBaySDK\Shopping\Services;
use \DTS\eBaySDK\Shopping\Types;
use \DTS\eBaySDK\Shopping\Enums;

会导致错误:

Fatal error: Cannot use DTS\eBaySDK\Shopping\Services as Services because the name is already in use in ...

但是,如果我在单独的php文件中使用它们,它们可以正常工作。我应该在这里改变什么?

1 个答案:

答案 0 :(得分:4)

你可以给他们一个像这样的别名:

use \DTS\eBaySDK\Finding\Services as ServicesOne;

use \DTS\eBaySDK\Shopping\Services as ServicesTwo;