<分区>
我养成了在 PHP 函数中抛出异常后包含 return false;
的习惯,即使 PHP docs state :
When an exception is thrown, code following the statement will not be executed, and PHP will attempt to find the first matching
catch
block. If an exception is not caught, a PHP Fatal Error will be issued with an "Uncaught Exception ...
" message...
但是,我仍然觉得在没有 catch
block 并且错误报告被关闭的情况下,返回 false
会更安全。
我是不是疯了才相信这个?