machete machete - 28 days ago 6
PHP Question

ZF2 route parameters with slash

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

Answer Source

Using rawurldecode() in the view solves this issue of course.