سؤال

When using error_log(..) in PHP I would like to specify the line where the error occurred :

error_log("something bad happened on line $LINE");

How can I do that ?

هل كانت مفيدة؟

المحلول

You should use a Magic constant called __LINE__, so:

error_log("something bad happened on line ".__LINE__);
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top