問題があります。独自のMVCアプリを作成していますが、モデルとコントローラーの間で変数を渡す際に問題があるようです。コントローラからの出力は、いくつかのjson形式のデータを含む単一の変数であり、単純に見えます。
コントローラ
<?php
class controllerLib
{
function __construct()
{
$this->view = new view();
}
public function getModel($model)
{
$modelName = $model."Model";
$this->model=new $modelName();
}
}
class controller extends controllerLib
{
function __construct()
{
parent::__construct();
}
public function addresses($arg = false)
{
echo'Addresses '.$arg.'<br />';
$this->view->render('addressesView');
$this->view->showAddresses = $this->model->getAddresses();
}
}
?>
意見
<?php
class view
{
function __construct()
{
}
public function render($plik)
{
$render = new $plik();
}
}
class addressesView extends view
{
public $showAddresses;
function __construct()
{
parent::__construct();
require 'view/head.php';
$result = $this->showAddresses;
require 'view/foot.php';
}
}
?>
ここで問題となるのは、$ this-> showAddressesがビューに渡されず、スタックしていることです。