phpのExceptionはgetMessageをするより__toStringしたほうがいい
PHP
<?php
try {
throw new Exception('message');
} catch (Exception $e) {
echo $e->getMessage() . "\n";
echo $e->__toString() . "\n";
exit(1);
}
?>
$ php /home/cockok/tmp/exception.php
message
exception 'Exception' with message 'message' in /home/cockok/tmp/exception.php:2
Stack trace:
#0 {main}
シェルが値を返しました 1
カテゴリー: 日記