如何在 php symfony 中解析异常对象
How to parse an exception object in php symfony
我有一个异常对象,它看起来像:
Exception Object ( [message:protected] => You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'selectPROFILEID,SUBSCRIPTION,MOD_DT,ACTIVATED,INCOMPLETE from newjs.JPROFILE whe' at line 1 [string:Exception:private] => [code:protected] => 0 [file:protected] => /var/www/html/JsMain/web/commonFiles/mysql_multiple_connections.php [line:protected] => 92 [trace:Exception:private] => Array ( [0] => Array ( [file] => /var/www/html/JsMain/web/jsadmin/add_edit_fields.php [line] => 46 [function] => mysql_error_js [args] => Array ( ) ) ) [previous:Exception:private] => )
我想使用 .message
访问此对象中的消息,对于其他值,依此类推。
print_r(($Var.message));
根本不起作用。请告诉我如何访问?
你试过 $var->getMessage();
因为它是一个 Exception
对象。
我有一个异常对象,它看起来像:
Exception Object ( [message:protected] => You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'selectPROFILEID,SUBSCRIPTION,MOD_DT,ACTIVATED,INCOMPLETE from newjs.JPROFILE whe' at line 1 [string:Exception:private] => [code:protected] => 0 [file:protected] => /var/www/html/JsMain/web/commonFiles/mysql_multiple_connections.php [line:protected] => 92 [trace:Exception:private] => Array ( [0] => Array ( [file] => /var/www/html/JsMain/web/jsadmin/add_edit_fields.php [line] => 46 [function] => mysql_error_js [args] => Array ( ) ) ) [previous:Exception:private] => )
我想使用 .message
访问此对象中的消息,对于其他值,依此类推。
print_r(($Var.message));
根本不起作用。请告诉我如何访问?
你试过 $var->getMessage();
因为它是一个 Exception
对象。