php - How do I encode a query string containing forward slashes? -


i need pass path parameter url e.g. /controller/action/my-path my-path contains forward slash e.g. /dir1/dir2/file.php there way of passing path single parameter or need break path down /controller/action/param1/dir1/param2/dir2/param3/file.php. sample code appreciated

tia ephraim

you can use url view helper, e.g.:

    echo $this->view->url(             array(             'controller' => 'somecontroller',                'action' => 'someaction',                 'path'=>'/dir1/dir2/file.php')             ); 

this result in:

public/somecontroller/someaction/path/%2fdir1%2fdir2%2ffile.php 

url view helper automatically uses url_encode encode parameters (see other anwser).


Comments

Popular posts from this blog

javascript - Iterate over array and calculate average values of array-parts -

iphone - Using nested NSDictionary with Picker -

objective c - Newbie question -multiple parameters -