PHP code example of jingwu / error
1. Go to this page and download the library: Download jingwu/error library . Choose the download type require .
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
jingwu / error example snippets
//启用自定义错误处理
register_shutdown_function(array(new \Jingwu\Error\ErrorHandle(),'Shutdown'));
set_error_handler(array(new \Jingwu\Error\ErrorHandle(), 'Error'));
set_exception_handler(array(new \Jingwu\Error\ErrorHandle(),'Exception'));
//设置错误级别及显示方式:
error_reporting(E_ALL ^ E_WARNING ^ E_NOTICE ^ E_DEPRECATED);
ini_set("display_errors", "On");
define('ERROR_DISPLAY_CLI', true);
define('ERROR_DISPLAY_HTML', false);
define('SYS_KEY', 'order');
error_reporting(E_ALL);
//error_reporting(E_ALL ^ E_WARNING ^ E_NOTICE ^ E_DEPRECATED);
ini_set("display_errors", "On");
define('ERROR_DISPLAY_CLI', true);
define('ERROR_DISPLAY_HTML', false);
define('SYS_KEY', 'order');
register_shutdown_function(array(new \Jingwu\Error\ErrorHandle(),'Shutdown'));
set_error_handler(array(new \Jingwu\Error\ErrorHandle(), 'Error'));
set_exception_handler(array(new \Jingwu\Error\ErrorHandle(),'Exception'));
function dump() {
var_dump($aa);
}
dump();
echo "\n\n";
at /data/code/jingwu/composerlib/php_error_handle/test.php 19
E_NOTICE: Undefined variable: aa
15: set_exception_handler(array(new \Jingwu\Error\ErrorHandle(),'Exception'));
16:
17:
18: function dump() {
19: var_dump($aa); //!!!please fix bug in here!!!
20: }
21:
22: dump();
23: echo "\n\n";
24: ...
Trace:
#0 /data/code/jingwu/composerlib/php_error_handle/test.php(19): Jingwu\Error\ErrorHandle->Error([8,"Undefined variable: aa","\/data\/code\/jingwu\/composerlib\/php_error_handle\/test.php",19,[]])
#1 /data/code/jingwu/composerlib/php_error_handle/test.php(22): dump([])