Yii 1.0:如何知道renderPartial 是否成功或失败? [英] Yii 1.0: how to know whether the renderPartial is success of fail?

查看:27
本文介绍了Yii 1.0:如何知道renderPartial 是否成功或失败?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在 Yii 1.0 框架中,如何知道 renderPartial 是成功还是失败?假设 $information 持有一个关联数组,它只运行 'detail/submitForm' 中的内容.请参阅下面的示例:

In Yii 1.0 framework, how to know whether the renderPartial is success of fail? Assume that $information holds an associative array which only running the content in 'detail/submitForm'. See sample below:

$this->renderPartial('detail/submitForm', array('information' => $information));

推荐答案

我想你可以将它包装在 try/catch 块中并使用标志变量,如下所示:

i guess you could wrap it in try/catch block and use a flag variable, like so:

// flag variable to hold renderPartial's status, set to true initially
$renderSuccess = true;
try {
    $this->renderPartial('detail/submitForm', array('information' => $information));
}
catch (Exception $ex) {
    $renderSuccess = false;
}

这篇关于Yii 1.0:如何知道renderPartial 是否成功或失败?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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