开发者

url to http request object

开发者 https://www.devze.com 2023-01-03 16:24 出处:网络
I need to convert string like this: $url = \'module/controller/action/param1/param1value/paramX/paramXvalue\';

I need to convert string like this:

$url = 'module/controller/action/param1/param1value/paramX/paramXvalue';

to url regarding current router (including translation and so on).

Usually I generate the target urls using url view helper, but for this I need to specify all params, so I would need to manually explode the string. I tried to use request object, like this:

$request = new Zend_Controller_Request_Http();
// some code here passing the $url

Zend_Debug::dump($request->getCo开发者_如何学CntrollerName()); // null instead of 'controllers'
Zend_Debug::dump($request->getParams());         // null instead of array

but this seems to be suspected. Do I need to dispatch this request?

How to handle this case well?


I haven't found any class in ZF for this task.

I just exploded the string, and this is fine too.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号