[英]pass named arguments from a route to a controller
给定以下控制器:
class Page { public function about($section){ switch($section){} } }
如何直接从$f3->route
将a值传递给Page-> about()?
Fat-Free将为每个路由处理程序填充两个参数。 因此,当您获得以下路线时: $f3->route('GET /about/@section','\\Page->about');
它将调用您的函数,第一个参数是框架实例,第二个参数是所有路由参数的数组。
class Page {
public function about($f3, $args){
switch($args['section']){}
}
}
有关更多详细信息,请参见http://fatfreeframework.com/routing-engine#RoutesandTokens 。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.