这些天我一直在努力解决这个问题。当我想在我的 URL 中添加“page”参数以进行分页时,我遇到了问题。
这是我的路由器
->addRoute('budi',new Zend_Controller_Router_Route(':lang/budi',array('controller' => 'budi', 'action' => 'index', 'page' => 1), array('lang'=>$s, 'page' => '\d+')))
->addRoute('budi1',new Zend_Controller_Router_Route(':lang/budi/page/:page',array('controller' => 'budi', 'action' => 'index', 'page' => 1), array('lang'=>$s, 'page' => '\d+')))
然后我访问我的网址
http://localhost/learningsystem/en/budi
但是当我将鼠标悬停在分页链接上时,页面参数不会出现。URL 仍然是 http://localhost/learningsystem/en/budi
但是如果我最后像这个一样输入带有索引的相同 URL
http://localhost/learningsystem/en/budi/index
或者喜欢这个
http://localhost/learningsystem/en/budi/page/1
当我单击第 2 页链接http://localhost/learningsystem/en/budi/index/page/2时,页面参数完美显示
实际上,我不想首先在我的 URL 中包含“索引”或“页面”。无论如何,我使用 Zend 的默认 pagination.phtml 模板。有人请帮我解决这个问题吗?
非常感谢