- android - RelativeLayout 背景可绘制重叠内容
- android - 如何链接 cpufeatures lib 以获取 native android 库?
- java - OnItemClickListener 不起作用,但 OnLongItemClickListener 在自定义 ListView 中起作用
- java - Android 文件转字符串
PHP 5.5 在 try/catch block 中添加了对 finally
的支持。
Java 允许您创建一个没有 catch block 的 try/catch/finally block ,因此您可以在发生异常时在本地进行清理,但让异常本身向上传播调用堆栈,以便可以单独处理。
try {
// Do something that might throw an exception here
} finally {
// Do cleanup and let the exception propagate
}
在当前的 PHP 版本中,您可以实现一些可以对异常进行清理并让它传播的东西,但如果没有抛出异常,则永远不会调用清理代码。
try {
// Do something that might throw an exception here
} catch (Exception $e) {
// Do cleanup and rethrow
throw $e;
}
PHP 5.5 会支持 try/finally 风格吗?我已经寻找过这方面的信息,但我能从 PHP.net 找到最接近答案的信息,只是暗示它没有。
In PHP 5.5 and later, a finally block may also be specified after the catch blocks. Code within the finally block will always be executed after the try and catch blocks, regardless of whether an exception has been thrown, and before normal execution resumes.
措辞表明您总是希望有一个 catch block ,但据我所知,它并没有直接说明。
最佳答案
关于PHP 5.5 并尝试......终于,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17208838/
PHP 5.5 在 try/catch block 中添加了对 finally 的支持。 Java 允许您创建一个没有 catch block 的 try/catch/finally block ,因
安装了Windows 11,你尝试过在系统上安装Android 应用吗? 前段时间,Windows 11安卓子系统运行 Android应用程序的第一个预览版现已提供给美国 Beta频道的 Wind
我是一名优秀的程序员,十分优秀!