在 Yii2 中将数据从一个控制器动作转发到另一个控制器动作 [英] Forward data from one controller action to other in Yii2

查看:23
本文介绍了在 Yii2 中将数据从一个控制器动作转发到另一个控制器动作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以在渲染之前将数据从一个控制器操作转发到另一个控制器操作?基本上,我想现在是否有 Zend _forward 所做的事情?

Is it possible to forward data from one controller action to other before the render? Basically, I want to now if we have something that Zend _forward does?

这是我的场景.我有一个支付网关,将数据返回给我的控制器操作,我想要的是处理单独的控制器/操作上的数据,但呈现主页(没有重定向).是否可以将控制从一个控制器/动作转发到另一个控制器?

Here is my scenario. I have a payment gateway that returns data back to my controller action, what I want is to handle data on separate controller/action but render the home page (without redirection). Is it possible to forward control from one controller/action to other ?

有人可以建议我去吗?

推荐答案

在 Yii 2 中,你可以使用这个产生与 forward() 相同的结果:

In Yii 2, you can use this which yields the same result of forward():

Yii::$app->runAction('new_controller/new_action', ['param1'=>'value1', 'param2'=>'value2']);

这篇关于在 Yii2 中将数据从一个控制器动作转发到另一个控制器动作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆