My class:
class mvc {
public function home () {
return 'index';
}
}
object:
include "./sys/controller/".$Current_page_Controller_name.".php";
// making object of the controller class.
$controller = new $Current_page_Controller_name;
// Cheks if model is called, m stands for "model"
if (isset($_GET['m'])) {
}
$method_name = $mvc->$Current_page_Controller_name.'()';
// Cheks if default model exists, if not gives an error.
if (method_exists($controller, $method_name)) {
echo "+";
} else {
echo "-";
//die("Lappas sledzis saplisis, gaidiet drizuma... (2)");
}
I keepgetting this error
Notice: Undefined property: mvc::$home in /home/unusuallv/domains/.../public_html/sys/config.php on line 51
the problem is near $method_name = $mvc->$Current_page_Controller_name.'()’; i know it, but i cant figure it out:// tnx a lot !
In the following expression:
The
->operator has higher precedence than the string concatenation operator (.). This means that PHP evaluates the expression$mvc->$Current_page_Controller_namefirst, so it tries to access the home property of the mvc class (which does not exist).Use this instead: