<?php
class B
{
public function test()
{
$this->va = "Hello world!";
}
}
class A
{
private $p;
function __construct()
{
$this->p = new B();
}
function say()
{
$this->p->test();
$str = $this->p->va;
echo $str;
}
}
$p1 = new A();
$p1->say();
?>
两个类调用
最新推荐文章于 2022-07-18 20:37:04 发布