PHP basic six

<!-- Error handling -->
<?php
    //php error handling prohibits the display of errors (display_errors)
    ini_set('display_error', 0);
    
    echo 'The status of display_errors in the server is'.ini_get('display_errors');
?>

<!-- php error handling value error reporting level -->
<?php
// E_ERROR
//     E_WARNING
// E_NOTICE
// E_PARSE
// E_ALL
//     E_STRICT
//     E_DEPRECATED
error_reporting();
    @$fp = fopen('adsaf.txt', 'r');
    echo 1;
?>

<!-- php error handling error log -->
<?php
// Configuration in php.ini
// log_errors
// log_errors_max_len
// error_log (emphasis)
    echo ini_get('log_errors');
    
    error_log("Unable to connect to database server server");
    error_log('You can use email to report errors, let the operation and maintenance personnel in the middle of the night
        Get up and work',1,'[email protected]');
    error_log("I am an error",3,"d:/test/my-errors.log");
?>

<!-- php error handling custom error handling function-->
<?php
    function customError($errno, $errstr,
        $errfile,$errline){
        echo "<b> Custom error:</b> [$errno] $errstr <br />";
        echo "Error on line $errline in $errfile<br/>";
        echo "Ending Script";
        exit;
    }
    set_error_handler("customError");
    
    $test=2;
    if ($test > 1) {
        trigger_error("A custom error has been triggered");
    }
?>










Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324652562&siteId=291194637