您好,欢迎来到三六零分类信息网!老站,搜索引擎当天收录,欢迎发信息

PHP反射类之妙用

2024/2/28 4:37:32发布23次查看
//php reflection class is to create a instance of a class which name isspecified ?php class abc { private $p1; private $p2; function __construct($array) { $this-p1 = $array [0]; $this-p2 = $array [1]; } function getp1() { return $this-p1;
//php reflection class is to create a instance of a class which name is specified
p1 = $array [0];
  $this->p2 = $array [1];
 }
function getp1() {
  return $this->p1;
 }
function getp2() {
  return $this->p2;
 }
}
$arr = array (0 => 'p1', 1 => 'p2' );
$class = new reflectionclass ( 'abc' );
$aobj = $class->newinstance ( $arr );
echo $aobj->getp1 ();
echo $aobj->getp2 ();
?>
该用户其它信息

VIP推荐

免费发布信息,免费发布B2B信息网站平台 - 三六零分类信息网 沪ICP备09012988号-2
企业名录 Product