Home >Backend Development >PHP Tutorial >如何打印出这个this的原形呢

如何打印出这个this的原形呢

WBOY
WBOYOriginal
2016-06-23 14:39:32956browse

本帖最后由 lghyt1 于 2013-12-14 16:03:30 编辑

<?phpclass A{    public $name;    public $age;    public function  getASelf() {        $this->name;        var_dump($this);    }}?>

突然对this的原形好奇,如何打出它的原形呢

回复讨论(解决方案)

实例化Class A,调用getASelf()
或者
实例化后即
$a = new A();

var_dump($a);

原来对象是这玩意object(A)#1 (2) { ["name"]=> NULL ["age"]=> NULL } 

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Previous article:请教关于CACTI工具的问题Next article:求教程