给出此代码:
class Test1
{
private $test3;
public function setTest3(Test3 $test3)
{
$this->test3 = $test3;
}
}
class Test2
{
private $test1;
public function setTest1(Test1 $test1)
{
$this->test1 = $test1;
}
}
class Test3
{
private $test2;
public function setTest2(Test2 $test2)
{
$this->test2 = $test2;
}
}
$test1 = new Test1();
$test2 = new Test2();
$test3 = new Test3();
$test1->setTest3($test3);
$test2->setTest1($test1);
$test3->setTest2($test2);
echo '<pre>'; var_dump($test1);echo '</pre><hr>';
echo '<pre>'; var_dump($test2);echo '</pre><hr>';
echo '<pre>'; var_dump($test3);echo '</pre><hr>';
var_dump()甚至回显递归。尽管效果很好,但这是一个不好的信号吗?