pass a variable in the url in zend

2019-08-04 22:36发布

问题:

I am not able to a pass a variable value in the URL in Zend.

echo '<a href="/page/page-info/page_id/"' .$this->hidden_page_id. '"/">Back</a>';

if I simple echo $this->hidden_page_id I get the value on the above page. But When I pass it above through a link it does not show the value. Do I have to store it in a session or something?

回答1:

What you get when do a var_dump?

var_dump($this->hidden_page_id);

An advice, use View Helpers:

echo '<a href="' . $this->url(array('controller' => 'page', 'action' => 'page-info', 'page_id' => $this->hidden_page_id)) . '">Back</a>';