反射获取类名

    xiaoxiao2021-03-26  24

    <? /* 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; } ?>
    转载请注明原文地址: https://ju.6miu.com/read-660697.html

    最新回复(0)