本文介绍了在PHP中检查方法可见性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 29岁程序员,3月因学历无情被辞! 有什么方法检查类方法是否已被声明为私有或公开?Is there any way of checking if a class method has been declared as private or public?我在一个控制器上工作,其中url映射到方法I'm working on a controller where the url is mapped to methods in the class, and I only want to trigger the methods if they are defined as public.推荐答案您可以使用 > 反射 扩展程序,请考虑这些:You can use the reflection extension for that, consider these: ReflectionMethod :: isPrivate ReflectionMethod :: isProtected ReflectionMethod :: isPublic ReflectionMethod :: isStaticReflectionMethod::isPrivateReflectionMethod::isProtectedReflectionMethod::isPublicReflectionMethod::isStatic 这篇关于在PHP中检查方法可见性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云!