$pages = array(
array(
'label' => 'Search',
'title' => 'Please Search',
'uri' => 'Search.php',
'params' => array('stcode'=>$stcode)
));
现在,pages数组将被传递给zend_naviagtion
$container = new Zend_Navigation($pages);
$view->getHelper('navigation')->setContainer($container);
我在pages数组中有几个项目可以帮助我显示菜单 当我点击该搜索页面时生成菜单 如果当时不存在stcode,则会将我带到index.php,因为代码已写入 它将重定向到index.php。现在我的问题是如何将stcode传递给该页面
答案 0 :(得分:1)
你的意思是通过ZF请求对象这样做:
$this->getRequest()->setParam("stcode", $the_value);
然后可以这样访问
$this->getRequest()->getParam("stcode");
// You can also pass an optional default value
$this->getRequest()->getParam("stcode", "wibble");
或者像这样
// This has no default value and may return an error depending on your configuration
$this->getRequest()->stcode;