douludi8413
2014-05-01 12:29
浏览 47
已采纳

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

Here's my code:

        $sm = $this->getServiceLocator();

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

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

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

I want to be able to pass $client to the $url e.g.

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

Thanks.

  • 写回答
  • 好问题 提建议
  • 追加酬金
  • 关注问题
  • 收藏
  • 邀请回答

1条回答 默认 最新

  • dousi1097 2014-05-01 12:38
    已采纳

    Just add the data to the query string:

    $url = "http://local.clients.com/";
    $url .= '?'.http_build_query(array('client' => $client));
    
    return $this->redirect()->toUrl($url);
    
    评论
    解决 无用
    打赏 举报

相关推荐 更多相似问题