时间:2021-07-01 10:21:17 帮助过:24人阅读
- <code>/**
- * 获得银行卡
- * @param array $data
- * @return string
- */
- public function getBank($data) {
- try {
- $client = $this->getClient();
- $params = $this->getConnectParams(array('username' => $data['username']));
- $response = $client->GetBank($params);
- $return_json = $response->GetBankResult;
- $return_arr = json_decode($return_json) ;
- $status = $return_arr->result ;
- } catch (\Exception $e) {
- self::addLog($e);
- $status = 'error';
- }
- }
- </code>
为什么yii 抛出的异常是yiibaseErrorException ? 我的Exception 系统异常也捕获不了 Yii抛出的异常? 如何解决既能捕获系统异常也能捕获Yii的 yiibaseErrorException 异常呢?
- <code>/**
- * 获得银行卡
- * @param array $data
- * @return string
- */
- public function getBank($data) {
- try {
- $client = $this->getClient();
- $params = $this->getConnectParams(array('username' => $data['username']));
- $response = $client->GetBank($params);
- $return_json = $response->GetBankResult;
- $return_arr = json_decode($return_json) ;
- $status = $return_arr->result ;
- } catch (\Exception $e) {
- self::addLog($e);
- $status = 'error';
- }
- }
- </code>
为什么yii 抛出的异常是yiibaseErrorException ? 我的Exception 系统异常也捕获不了 Yii抛出的异常? 如何解决既能捕获系统异常也能捕获Yii的 yiibaseErrorException 异常呢?
可能是你的PHP版本太低了,记得一次PHP版本升级note里有说修复一下异常的问题;
我用PHP5.5试了,不出现你说的问题。