如何通过Zend Framework中的链接传递值?

时间:2011-08-09 08:50:17

标签: php zend-framework

我想通过

传递值
<a href= <?php  $this->baseUrl()/admin/registration/activate/>  </a>

这是我的代码,我必须将用户ID传递给此网址以激活用户。我必须使用的内容我将获得用户ID <?php $this->userid; ?> 请帮忙 我的行动是

public function activateAction()
    {  // Administrator actvate user
        $user_name = $this->getRequest()->getParam('user_name');
        $reg = new clmsRegistrationModel();
        $reg->setActive($user_name);
    }

2 个答案:

答案 0 :(得分:0)

你的行动

$this->_request->getParam('prop_id', null);

答案 1 :(得分:0)

让我们假设您有Controller Index和Action Customer,因此您可以使用Zend Framework View帮助程序构建链接(在视图脚本中):

 echo $this->url(array(
      'controller' => 'index', 
      'action'     => 'customer', 
      'prop_id'    => 5
 ));
控制器中的

customerAction() {
      $propId = $this->getRequest()->getParam('prop_id');
}

发表评论后(添加到您的视图脚本):

<?php $postUrl = $this->url(array(
     'controller' => 'admin',
     'action'     => 'registration',
     'activate'   => $this->userid     
)); ?>

<a href="<?php echo $postUrl; ?>"> Activate </a>