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 Framework 2 中,我想从布局 html 文件中获取当前操作,以了解哪个菜单处于活动状态(用于 css 目的)。 有没有人信息我该怎么做? 我尝试了许多可能的解决方案,但所有这些都是无用的。 非常感谢!
所以基于雷米的第二个链接,完整的代码是:
public function onDispatch(MvcEvent $e) { $this->layout()->action = $this->params("action"); return parent::onDispatch($e); }
有了这个总是可以发送任何数据进行布局。但仅用于布局。
看看堆栈溢出
你也应该把你已经测试过的代码。