class posts
{
public function __construct($db)
{
$this->dbase = $db;
$test = new post(1, $this->dbase);
}
}
class post
{
public function __construct($id, &$j)
{
$this->ID = $id;
$this->dbase = $j;
var_dump($this); // At this point, $this-ID and $this->dbase are both null.
}
}
これが私の問題です。「post」クラスでは、$jと$idをダンプして、両方が完全に渡されることを確認できます。ただし、$ this-> ID =$idまたは$this->dbase = $ jを設定しようとすると、何も設定されません。なぜこれでしょうか?