面向对象类之间的引用

来源:互联网 发布:vue.js教程 编辑:程序博客网 时间:2024/06/05 06:23

今天写项目的时候写了一段程序,觉得挺有意思的。


<?php$t = new test();echo $t->msg;class test{public $msg;function test(){$this->msg = "aaaaa";$this->note = new note($this);$this->t_change_msg();}function t_change_msg(){$this->msg = "sssss";}}class note{public $test;function note($test) {$this->test = $test;$this->n_change_msg();}function n_change_msg(){$this->test->msg = "ddddd";return $this->test->msg;}}




0 0
原创粉丝点击