php 反射

<?php
class HelloWorld {
    public function sayHelloTo($name) {
        return 'Hello ' . $name;
    }
}

$reflectionMethod = new ReflectionMethod('HelloWorld', 'sayHelloTo');
echo $reflectionMethod->invoke(new HelloWorld(), 'Mike');
?> 

 

posted @ 2016-09-20 13:16  fleam  阅读(146)  评论(0编辑  收藏  举报