我有执行python cgi的PHP代码,我想传递python跟踪(从cgi返回)作为额外的数据到php异常我该怎么做呢?我怎样才能从中获取该值catch(Exception e) {
(它应该检查是否有额外的值exesit ).
我有这样的代码:
$response = json_decode(curl_exec($ch)); if (isset($response->error)) { // how to send $response->trace with exception. throw new Exception($response->error); } return $response->result;
我使用json-rpc库,应该将该数据返回给用户:
} catch (Exception $e) { //catch all exeption from user code $msg = $e->getMessage(); echo response(null, $id, array("code"=>200, "message"=>$msg)); }
我是否需要编写新类型的异常,或者我可以正常Exception
吗?我想发送所有扔进去的东西"data" =>