Is it possible to assemble a route with parameters containing forward slashes?
Config:
'someroute' => array(
'type' => 'Zend\Mvc\Router\Http\Segment',
'options' => array(
'route' => 'someroute/:path',
'defaults' => array(
'controller' => 'Controller',
'action' => 'index'
),
'constraints' => array(
'path' => '(.)+'
)
)
)
Controller:
$path = 'some/subdirectory';
$this->url('someroute', array('path' => $path));
Results in:
http://host.name/someroute/some%2Fsubdirectory
I had a similar problem, so I'm posting found solution with Zend 3 to my project.
Basically, you can allow all characters, and then check/trycatch/validate in the action.
Ref: How to Allow a "/" Character in a Route Parameter
Using
rawurldecode()
in the view solves this issue of course.Just use the
regex
route type: