在zf2中将会话变量传递给外部URL

时间:2014-05-01 12:29:00

标签: php zend-framework2

这是我的代码:

        $sm = $this->getServiceLocator();

        $session = $sm->get('SessionContainer');
        $client = $session->offsetGet('client');

    $url = "http://local.clients.com/"

    $this->redirect()->toUrl($url);

我希望能够将$ client传递给$ url,例如

$this->redirect()->toUrl($url,$client);

感谢。

1 个答案:

答案 0 :(得分:0)

只需将数据添加到查询字符串中:

$url = "http://local.clients.com/";
$url .= '?'.http_build_query(array('client' => $client));

return $this->redirect()->toUrl($url);