PHP how to list out all public functions of class

后端 未结 4 1634
悲&欢浪女
悲&欢浪女 2020-12-30 02:32

I\'ve heard of get_class_methods() but is there a way in PHP to gather an array of all of the public methods from a particular class?

4条回答
  •  误落风尘
    2020-12-30 03:18

    Have you try this way?

    $class_methods = get_class_methods(new myclass());
    
    foreach ($class_methods as $method_name) {
        echo "$method_name\n";
    }
    

提交回复
热议问题