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.
PHPによってエラーが生成されたコード行を検出することは可能ですか? たとえば、通知アラートがある場合、次のように返されます。
Notice: Undefined index: XX in / home / YY.php on line 17.
エラーハンドラーをset_error_handler次のように登録できます。
set_error_handler
set_error_handler(function($errno, $errstr, $errfile, $errline) { $lines = file($errfile); $line = $lines[$errline - 1]; print "Line with error: $line"; });