$ this-> id和$ id有什麼區別?
class Test{
public $id;
function Test(){
$this->id = 1;
}
}
===
class Test{
public $id;
function test(){
$id = 1;
}
}
如何從其他類中的變量?
class TestA{
public $test;
function TestA(){
$this->test = new Test();
echo $this->test->id;
}
}
請注意,您缺少一對'}' – elclanrs