FuelPHP \URI::current() 没有获取文件扩展名
FuelPHP \URI::current() does not get file extension
我的项目要求我知道调用路由时使用的文件扩展名。
例如,
如果路由是 127.0.0.1/controller/action/filea.json
然后我需要有一个函数,当从内部操作函数“get_action”调用时,returns“。json”。
如果路由是 127.0.0.1/controller/action2/fileb。xml
那么当从动作函数“get_action2”内部调用时,函数应该 return“.xml”。
现在,我尝试使用 \URI::current(),但这只会让我得到“127.0.0.1/controller/action/filea”或“127.0.0.1/controller/action2/fileb”
是否使用扩展由配置键routing.strip_extension
控制,默认为真
可以使用 \Input::extension()
检索当前扩展名。
我的项目要求我知道调用路由时使用的文件扩展名。
例如, 如果路由是 127.0.0.1/controller/action/filea.json 然后我需要有一个函数,当从内部操作函数“get_action”调用时,returns“。json”。
如果路由是 127.0.0.1/controller/action2/fileb。xml 那么当从动作函数“get_action2”内部调用时,函数应该 return“.xml”。
现在,我尝试使用 \URI::current(),但这只会让我得到“127.0.0.1/controller/action/filea”或“127.0.0.1/controller/action2/fileb”
是否使用扩展由配置键routing.strip_extension
控制,默认为真
可以使用 \Input::extension()
检索当前扩展名。