[英]return values of components in Yii
Yii框架:)假设我们有两个文件,一个控制器:
Yii::app()->egopay->testf('testtext_testtext_testtext');
echo $test;
第二部分:
public function testf($t){
$test = $t;
return $test;
}
我有一个很长的代码,其值不会复制,而是按相同的原理工作,因此,必须从组件向控制器支付变量。 为什么我不能显示返回值部分?
我先看看是否可以使用Braintree代替egopay。 但这并不总是开发人员的选择...然后在protected / extensions / BraintreeApi /中使用braintree扩展
如果没有,请使用Egopay SCI软件包并将其放入其中,然后说:
protected/extensions/EgopayApi/
然后在付款管理器中? 大车? 对付款链接进行新的操作:
public function actionPayment() {
$model = ; # maybe find by primary key for user?
# example: $model = User::model()->findByPk(Yii::app()->user->id);
Yii::import('ext.EgoPaySci.models.EgopayCCForm'); # Brings in the EgoPaySci.php and form if any
$payment = new EgopayCCForm(array('store_id' => 8888, 'store_password' => 'JkkYhs7ft'));
来自EgoPaySci.php的值可通过以下方式获得:$ payment
抱歉,我含糊不清,但我假设您正在使用付款网关。 并且有很多细节需要解释。 但是在Controller中对其进行设置将使其可用于模型,因此也可用于视图。
不完全是我的意思。 并且这里准备好喜欢某人需要:)
controller:
$test = Yii::app()->egopay->testf('testtext_testtext_testtext');
echo 'variable a:'.$test['a'];
echo $test['b'];
echo $test['c'];
components:
public function testf($t){
$var['a'] = $t;
$var['b'] = 'variable b: '.$t;
$var['c'] = 'variable c: '.$t;
return $var;
}
但无论如何,感谢您的回复:)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.