Home  >  Article  >  Backend Development  >  xammp mac系统无法创建error日志

xammp mac系统无法创建error日志

WBOY
WBOYOriginal
2016-06-06 20:17:311327browse

<code><?php #自定义错误函数
    function my_error3($errno,$errmes){
        $err_info="错误号是".$errno."--".$errmes;
        #echo"错误号是".$errno."--".$ermes;
        echo $err_info;
    #把这个错误信息保存
        error_log($err_info."\r\n",3,"myerr.txt");
    }

    function my_error4($errno,$errmes){
        echo"出大事了".$nerro;
        exit();
    }

    #指定E_USER_WARNING 错误级别的函数
    #set_error_handler("my_error4",E_USER_ERROR);
    set_error_handler("my_error3",E_USER_WARNING);

    $age=700;
    if($age>120){
        trigger_error("输入年龄过大",E_USER_WARNING);
    }
    echo "ok";
 ?></code>

回复内容:

<code><?php #自定义错误函数
    function my_error3($errno,$errmes){
        $err_info="错误号是".$errno."--".$errmes;
        #echo"错误号是".$errno."--".$ermes;
        echo $err_info;
    #把这个错误信息保存
        error_log($err_info."\r\n",3,"myerr.txt");
    }

    function my_error4($errno,$errmes){
        echo"出大事了".$nerro;
        exit();
    }

    #指定E_USER_WARNING 错误级别的函数
    #set_error_handler("my_error4",E_USER_ERROR);
    set_error_handler("my_error3",E_USER_WARNING);

    $age=700;
    if($age>120){
        trigger_error("输入年龄过大",E_USER_WARNING);
    }
    echo "ok";
 ?></code>
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn