Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我的应用程序中有多个Zend_Navigation对象。我想做一个测试来找出哪个对象包含我当前所在的页面。我没有在文档中看到这样做的方法。这可以实现吗?如何?
Zend_Navigation
谢谢!
AFAIK 没有公共方法可以一次递归地比较容器中的所有页面。
您可以实现自己的方法迭代容器中的所有页面和子页面(Zend_Navigation实现RecursiveIterator)并检查$container->isActive()状态或将容器参数与当前进行比较$request->getParams();。
RecursiveIterator
$container->isActive()
$request->getParams();
findById()在使用了一些非常特定于我的实现的逻辑来确定哪个导航对象应用于当前请求之后,我最终使用了该函数。
findById()