Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有个问题。Throwable 不会为 require 或 include 函数返回异常。有没有办法“修复”它?代码:
try { include 'non-existent-file.php'; #require 'non-existent-file.php'; } catch (\Throwable $ex) { die('include error'); }
预先感谢您的帮助。
你有没有想过使用file_exists ( string $filename )...
file_exists ( string $filename )
if ( file_exists('non-existent-file.php') === true) { include 'non-existent-file.php'; } else { die('include error'); }