我正在尝试从以下异常对象获取sqlslate代码:
SQLSTATE[42000]: Syntax error or access violation: 1064 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 xx at line 1 in xx.
我正在使用以下代码:
var_dump("code is: ".$exception->getCode());
但它会返回0
。我怎样才能获得像420000这样的代码。