Answer the question
In order to leave comments, you need to log in
Why does the model return an object?
The code:
class newsView
{
public function __construct($model)
{
//Это пришло из конструктора модели
var_dump($model);
}
public function listmodel() {
return 1;
}
}
class newsModel
{
public function __construct()
{
return 'Это вернула newsModel';
}
}
class My
{
public function showdata()
{
$model = new newsModel;
$view = new newsView($model);
$result = $view->listmodel();
return $result;
}
}
$obj = new My();
$res = $obj->showdata();
var_dump($model);
shows:object(newsModel)#32 (0) {
}
This returned newsModel?
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question