Zend Framework:为控制器的每个操作添加数据到布局
我正在编写一个 Web 应用程序,我需要在一个特定控制器的所有操作中返回/计算的所有数据,以将数据返回到布局(而不是视图)。
因此,在每个操作之后,需要将控制器变量传递给布局,以便布局可以使用它。
详细来说,我想将计算出的数据存储在head中的json中。
有人知道如何做到这一点吗? 我考虑过一个控制器插件,但我不知道如何访问所需的参数,而且我真的不想使用单例来完成这一切。
i am writing a web application and i need all the data returned/computed in all actions of one specific controller to return data to the layout (not the view).
So after each action, a controller variable needs to be passed to the layout so the layout can use it.
In detail, i want to store the calculated data in jSon in the head.
Any ideas anyone of how to do this?
I thought about a controller plugin but i have no idea of how to access the desired parameters then and i really don't want to use a singleton for all this.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
,此方法在每个操作之前执行
让我们使用,例如
Let use, this method is executed before every action
for example