<?php header("Content-Type:text/html;charset=utf-8"); class Baiduqq { public static $name = "baiduzhidao"; static private function ask($name) { echo "hello world".$name; } } $refclass = new ReflectionClass("Baiduqq"); $properties_arr = $refclass->getdefaultproperties(); $method = $refclass->getMethod("ask"); if ($method->isPrivate()) { $method->setAccessible(true); } $instance = $refclass->newInstance(); $method->invokeArgs($instance,["name"=>$properties_arr['name']]);
用类的反射获取 父类的私有属性方法
^_^ 亲爱的客官,如果您觉得本文对您有好处,请移动你的鼠标点点下面的关注我,一起学习,一起分享.~ ^_^