PHP流畅的界面检查方法是否存在 [英] PHP fluent interface check if method exists
本文介绍了PHP流畅的界面检查方法是否存在的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我需要检查我的班级是否存在某种方法,然后在此处调用它是我的代码:
i need to check if there is a method exists on my class or not before i call it here is my code :
展开 | 选择 | Wrap | 行号
推荐答案
检查方法是否使用 method_exists()或检查接口。
to check for a method either use method_exists() or check against an interface.
在我的在我调用方法之前,我会检查我的代码吗?
in my case where i would check in my code ?
,但这取决于真实代码以及你想在那里做什么。
at latest just before you call the method, but it depends on the real code and what you want to do there.
这篇关于PHP流畅的界面检查方法是否存在的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文