有没有办法为 5.5 以下的 PHP 版本实现 finally 块?
你可以这样做,
try { # ... } catch (Exception $e) { # ... but don't re- throw $e! } # ... finally ... if (isset ($e)) { throw $e; }
但是,我建议升级 PHP。不应该那么麻烦。