دالة PHP error_reporting ()
مثال
حدد مستوى مختلف للإبلاغ عن الخطأ:
<?php
// Turn off error reporting
error_reporting(0);
// Report runtime errors
error_reporting(E_ERROR | E_WARNING | E_PARSE);
// Report all errors
error_reporting(E_ALL);
// Same as error_reporting(E_ALL);
ini_set("error_reporting", E_ALL);
// Report all errors except E_NOTICE
error_reporting(E_ALL & ~E_NOTICE);
?>
التعريف والاستخدام
تحدد الوظيفة error_reporting () الأخطاء التي يتم الإبلاغ عنها.
تحتوي PHP على العديد من مستويات الأخطاء ، واستخدام هذه الوظيفة يعيّن هذا المستوى للنص الحالي.
بناء الجملة
error_reporting(level);
قيمه المعامل
Parameter | Description |
---|---|
level | Optional. Specifies the error-report level for the current script. Error numbers and named constants are accepted. Note: Named constants are recommended to ensure compatibility for future PHP versions |
تفاصيل تقنية
قيمة الإرجاع: | تُرجع مستوى الإبلاغ عن الخطأ القديم أو مستوى الإبلاغ عن الخطأ الحالي إذا لم يتم توفير معلمة مستوى |
---|---|
إصدار PHP: | 4.0+ |
سجل التغيير في PHP: | PHP 5.4: أصبح E_STRICT الآن جزءًا من E_ALL. PHP 5.3: جديد: E_DEPRECATED و E_USER_DEPRECATED. PHP 5.2: جديد: E_RECOVERABLE_ERROR. PHP 5.0: جديد: E_STRICT. |
مرجع أخطاء PHP