php - Get information about matched route in Fat Free version 2.0.x -



php - Get information about matched route in Fat Free version 2.0.x -

i'm using legacy version 2.0 of fat free framework. i'm bolting on code needs called every request.

i want examine route matched, find can in beforeroute method using this:

$routedata = f3::get('params');

if route defined thus:

f3::route('get /@customer/dictionary/@key', 'controllers\dictionaries->viewkey');

then examining $routedata gives:

array( [0] => /custname/dictionary/mykey [customer] => custname [key] => mykey )

that's start, i'd obtain get /@customer/dictionary/@key or /@customer/dictionary/@key. suppose swap out key values regexs , match way, it'd nice have cleaner way it!

note question has been asked version 3, no me @ present. we'd upgrade, that's not possible @ moment.

as of release 2.1.0, can get:

the request method $_server['request_method'] (no dedicated f3 variable in version 2) the matched route pattern f3::get('pattern') the matched route parameters f3::get('params')

so in case:

echo $_server['request_method'];// echo f3::get('pattern');// /@customer/dictionary/@key echo f3::get('params.customer');// custname echo f3::get('params.key');// mykey

php routing fat-free-framework

Comments

Popular posts from this blog

model view controller - MVC Rails Planning -

ruby on rails - Devise Logout Error in RoR -

html - Submenu setup with jquery and effect 'fold' -