私自身のテストでは、システムのようなコマンドを使用して例外をバブルすることができませんでした。これを実現する方法があるかどうか、ただ興味がありますか?
test1.php:
<?php
try {
// None of these (which throw an exception)
// allow exception to be caught here
passthru("php -f test2.php");
system("php -f test2.php");
exec("php -f test2.php");
} catch (Exception $e) {
echo( "Caught exception: " . $e->getMessage() );
}
?>
test2.php:
<?php
// Throw an exception
throw new Exception();
?>
インクルードでキャッチできることは知っていますが、私の目的では、それを使用できません。この方法でスクリプトを実行するときに、例外をキャッチまたは「バブルアップ」する方法はありますか?