val2 = "bar"; return true; } function test1() { return true; } } //get_class_methods() 返回由类的方法">
时间:2021-07-01 10:21:17 帮助过:7人阅读
class myclass {
var $var1;
var $var2 = 'xyz';
var $var3 = 100;
private $var4;
function myclass() {
$this->val1 = "foo";
$this->val2 = "bar";
return true;
}
function test1() {
return true;
}
}
//get_class_methods() 返回由类的方法名组成的数组
get_class_methods('myclass') 或 get_class_methods(new myclass()) ;
//get_class() 返回对象的类名
//get_class_vars() 返回由类的默认属性组成的数组
$my_class = new myclass();
$class_vals = get_class_vars(get_class($my_class));
foreach($class_vars as $name => $value) {
echo "$name : $value\n
";
}
?>
http://www.bkjia.com/PHPjc/323502.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/323502.htmlTechArticle 代码如下:
?php class myclass { var $var1; var $var2 = 'xyz'; var $var3 = 100; private $var4; function myclass() { $this-val1 = "foo"; $this-val2 = "bar"; return tr...