PHP:接口路径
我需要知道定义接口的文件的路径。我知道名称和接口可用(该文件包含在代码中的另一个位置)。我知道诸如 __FILE__ 等之类的东西,但重点是,它只是一个接口,我没有实例。具有讽刺意味的是,我需要找到合适的接口实现的路径。
有谁知道找到路径的方法吗?
感谢您的帮助!
I need to know the path of a file in which an interface is defined. I know the name and the interface is available (the file was included at another location in the code). I know things like __FILE__
, etc. but the point is, it's only an interface, i do not have an instance. Ironically, i need the path to find a suitable implementation for the interface.
Does anyone know a way to find the path?
Thanks for your help!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
尽管有这个名字,ReflectionClass 也适用于接口。所以你可以使用
Despite the name, ReflectionClass works on interfaces too. So you can use