0

这对我来说似乎是一个挑战!我需要显示不同密码/邮政编码的动态内容。因此,如果我没记错的话,zend 使用 url 的方式是控制器/动作!

通常用户将通过单击锚标签来选择密码/邮政编码。那么我如何创建实现这一点的逻辑。显然,创建不同的 pincode / zipcode 控制器和操作以及各自的视图是一个坏主意。

你会推荐我的最好方法是什么?如果不清楚,请原谅我。如果需要,我会尝试提供更多信息。

谢谢。

4

1 回答 1

1

You might pass the pincodes/zipcodes in the URL as parameters to your action. For instance, you could have something like:

<a href="http://yourhost/yourcontroller/youraction/zipcode/12345">12345</a>

And then, inside your controller, you can get the value of the parameter like that:

public function youractionAction()
{
    $zipcode = $this->_getParam('zipcode', '');

    //
    // Generate the dynamic content based on the value of the zip code...
    //
}

Hope that helps,

于 2012-05-11T08:59:00.827 回答