PHP get error message method, PHP get error message _php Tutorial

Source: Internet
Author: User

PHP get error message method, PHP get error message


The example in this article describes how PHP obtains error information. Share to everyone for your reference. Specific as follows:

function Error_reg () {$ar =array (  e_error = ' error ',  e_warning = ' WARNING ',  e_parse = ' prase ',  e_notice = ' NOTICE '); Register_shutdown_function (function () use ($ar) {  $ers =error_get_last ();  if ($ers [' type ']!=8 && $ers [' type ']) {   $er = $ar [$ers [' type ']]. $ers [' type ']. ': '. ' '. $ers [' message ']. ' = '. $ers [' file ']. ' Line: ' $ers [' line ']. ' '. Date (' y-m-d h:i:s '). " \ n ";   Error_log ($er, 3, '/tmp/php_error.log ');  } }); Set_error_handler (function ($a, $b, $c, $d) use ($ar) {  if ($a!=8 && $a) {   $er = $ar [$a]. $a. ': ' $b. ' = ' . $c. ' line: '. $d. '. Date (' y-m-d h:i:s '). " \ n ";   Error_log ($er, 3, '/tmp/php_error.log ');  } },e_all ^ e_notice);}

I hope this article is helpful to everyone's PHP programming.

http://www.bkjia.com/PHPjc/1034254.html www.bkjia.com true http://www.bkjia.com/PHPjc/1034254.html techarticle PHP Get error message method, PHP get error message This article describes how PHP gets the error message. Share to everyone for your reference. Specific as follows: function Error_reg () {...

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.