简体   繁体   中英

FuelPHP \URI::current() does not get file extension

My project requires me to know what file extension was used while calling a route.

For example, If the route was 127.0.0.1/controller/action/filea.json Then then I would need to have a function that returns ".json" when called from inside action function "get_action".

If the route was 127.0.0.1/controller/action2/fileb.xml Then then the function should return ".xml" when called from inside action function "get_action2".

Right now, I tried using \URI::current(), but that only gets me "127.0.0.1/controller/action/filea" or "127.0.0.1/controller/action2/fileb"

Whether or not the extension is used is controlled by the config key routing.strip_extension , which is true by default.

The current extension can be retrieved using \Input::extension() .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM