I'm new to fat free framework and i'm a little bit confused about the global variables.
$f3->route('GET /@page','display');
function display($f3) {
echo 'I cannot object to an object' . $f3->get('PARAMS.page');
};
$f3->run();
Here i'm using GET /@page as a token for the url route. In the function i then use $f3->get('PARAMS.page') to get the value of that variable.
Since $f3->get is the method to get a global variable, why do i have to pass the $f3 class to the function.
The below code doesn't work ($f3 class not passed to the function).
$f3->route('GET /@page','display');
function display() {
echo 'I cannot object to an object' . $f3->get('PARAMS.page');
};
$f3->run();
So my question is: why do i have to pass the $f3 class to the function?
Thx...