php – 斜杠的ZF2路由参数
发布时间:2020-12-13 17:16:44 所属栏目:PHP教程 来源:网络整理
导读:是否可以使用包含正斜杠的参数组装路径? 配置: 'someroute' = array( 'type' = 'ZendMvcRouterHttpSegment','options' = array( 'route' = 'someroute/:path','defaults' = array( 'controller' = 'Controller','action' = 'index' ),'constraints' =
是否可以使用包含正斜杠的参数组装路径?
配置: 'someroute' => array( 'type' => 'ZendMvcRouterHttpSegment','options' => array( 'route' => 'someroute/:path','defaults' => array( 'controller' => 'Controller','action' => 'index' ),'constraints' => array( 'path' => '(.)+' ) ) ) 控制器: $path = 'some/subdirectory'; $this->url('someroute',array('path' => $path)); 结果是: http://host.name/someroute/some%2Fsubdirectory 解决方法
在视图中使用rawurldecode()当然可以解决这个问题.
(编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |