我读到这个Article 我想了解一下这个部分:
try {
//First try getting our user numero uno
$user = new User(1);
//Then, let's try to get the exception
$user2 = new User('not numeric');
} catch(Exception $e) {
echo "Donkey Kong has caught an exception: {$e->getMessage()}";
}
为什么{$e->getMessage()}
必须覆盖支架?
有没有关于这个PHP手册的任何链接的解释?
我知道如果我们不把括号它会显示错误,但我想要的是得到解释为什么需要括号。
公告:未定义的属性:异常:: $的getMessage
http://php.net/manual/en/language.types.string.php“变量解析” – Josh 2011-12-29 18:32:00
@Josh请把你的答案放在答案部分,而不是评论部分所以我可以批准你的答案。 – GusDeCooL 2011-12-29 18:34:48