I am having a problem on my MVC framework. Here is my loadModel()
method inside the main controller:
public function loadModel($name) {
$path = 'models/' . $name . '_Model.php';
if (file_exists($path)) {
require $path;
$modelName = $name . '_Model';
$this->model = new $modelName;
}
}
As you can see, when i try to load a controller, it automatically loads a model with the same name + _model.php
.
I do not have any problem, when I use wamp or xampp, but, when I uploaded it in my website, it says "Undefined property"
on every model. That means the model is not loaded. I know the problem is in there...
Is that some kind of an error in php.ini file of the server? Or maybe it because of different PHP versions?