How do you send POST parameters to a function in PHP using Fat-Free-Framework? -
the documentation on website bit lacking (http://fatfreeframework.com/routing-engine). want use shorthand expression of post:
$f3->route('post /login','auth::login');
how send params auth->login() function above?
this alternative way of writing it, bit longer:
$f3->route('post /login', function($f3) { $params = $f3->get('post'); $auth = new auth; $auth->login($params['username'], $params['password']); } );
if mean auth::login
should automatically receive post data argument, can't.
all f3 route handlers receive following arguments:
- the framework instance
- the route tokens (if any)
see here example.
anyway, if auth->login
function you're referring one included in framework, couldn't work in manner since login()
function is not route handler. returns true
or false
. route handler has little bit more that: example, reroute user on success or display login form again on error.
Comments
Post a Comment