php – 斜杠的ZF2路由参数
作者:互联网
是否可以使用包含正斜杠的参数组装路径?
配置:
'someroute' => array(
'type' => 'Zend\Mvc\Router\Http\Segment',
'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()当然可以解决这个问题.
标签:php,routes,zend-framework2,slash,zend-route 来源: https://codeday.me/bug/20190625/1284178.html