开发者

Redirecting to external url with params using zend framework

I want to redirect users to a ext开发者_开发技巧ernal payment gate with some parameters using zend.is there any standard way of doing it ?

really appreciate any advice and suggestions.

thanks.


You could use the built in PHP function of http_build_query to build the parameters, then feed that to the gotoUrlAndExit() function of Zend Framework.

$url = "https://external.gateway.com/";
$data = array('foo'=>'bar',
              'baz'=>'boom',
              'cow'=>'milk',
              'php'=>'hypertext processor');

$query = http_build_query($data);

$this->_helper->redirector->gotoUrlAndExit($url . '?' . $query);


In ZF there is Redirector action helper. It has methods called gotoUrl() and gotoUrlAndExit() that can be used to go to external urls. Maybe this helper will be suited for your needs.


$this->_redirect($url);

Just put it in your action

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜