<?
/* Pass the name of the class, not a declared handler */
function get_public_methods($className) {
/* Init the return array */
$returnArray = array();
/* Iterate through each method in the class */
foreach (get_class_methods($className) as $method) {
/* Get a reflection object for the class method */
$reflect = new ReflectionMethod($className, $method);
/* For private, use isPrivate(). For protected, use isProtected() */
/* See the Reflection API documentation for more definitions */
if($reflect->isPublic()) {
/* The method is one we're looking for, push it onto the return array */
array_push($returnArray,$method);
}
}
/* return the array to the caller */
return $returnArray;
}
?>
反射获取类名
最新推荐文章于 2023-08-04 10:19:10 发布