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

xammp mac系统无法创建error日志

WBOY
Release: 2016-06-06 20:17:31
Original
1361 people have browsed it

<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>
Copy after login
Copy after login

回复内容:

<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>
Copy after login
Copy after login
Related labels:
php
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template