如何在PHP中使用相同的命名类没有命名空间? [英] How to use same named class in PHP without namespacing?

查看:325
本文介绍了如何在PHP中使用相同的命名类没有命名空间?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个问题,我有两个第三方库类,我必须扩展和使用在一起。但是两者都有相同的命名约定,两个类名最后具有相同的名称。

I have a problem, where I have two third party libraries classes that I have to extend and use together. But both have the same naming convention and two class name end up having the same name.

由于我不能扩展两个类,我不知道如何修复它们,如何创建一个包装器。我不能使用PHP命名空间作为PHP版本只是5.2.10而不是5.3。

Since I cannot extend two classes, I don't know how to fix them, how to create a wrapper against one. I cannot use PHP Namespaces as the PHP version is just 5.2.10 and not 5.3.

我有什么选项?

推荐答案

我想你可以实现rpc像接口,一个类。对于其他你可以扩展和使用。
http://en.wikipedia.org/wiki/Remote_procedure_call

I think you can implement rpc like interface, for one class. For other you can extend and use. http://en.wikipedia.org/wiki/Remote_procedure_call

这篇关于如何在PHP中使用相同的命名类没有命名空间?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆