Yii 1.0: how to know whether the renderPartial is success of fail?

时光怂恿深爱的人放手 提交于 2020-03-05 04:04:32

问题


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));

回答1:


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;
}


来源:https://stackoverflow.com/questions/50962216/yii-1-0-how-to-know-whether-the-renderpartial-is-success-of-fail

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!