dongyou5271 2013-07-19 18:33
浏览 18
已采纳

PHP错误处理函数或类?

I'm getting close to taking a PHP application live and so I know that I need to disable error reporting (to hide errors from users) and instead log the errors.

I found the set_error_handler function in the PHP docs and there is an example shown, but I'm wondering if there is any kind of standard error handler function (to be set as the callback in set_error_handler) or class that is typically used by PHP developers to log errors?

If there isn't a function or class that is considered "standard," would you show your error handling function?

  • 写回答

2条回答 默认 最新

  • dousunle5801 2013-07-19 18:36
    关注

    Your best bet would be to make changes to the php.ini file to turn on-screen error reporting off but error logging on:

    ini_set("display_errors", 0);
    ini_set("log_errors", 1);
    ini_set("error_reporting", E_ALL &~E_DEPRECATED);
    ini_set("error_log", "error.log");
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 随身WiFi网络灯亮但是没有网络,如何解决?
  • ¥15 gdf格式的脑电数据如何处理matlab
  • ¥20 重新写的代码替换了之后运行hbuliderx就这样了
  • ¥100 监控抖音用户作品更新可以微信公众号提醒
  • ¥15 UE5 如何可以不渲染HDRIBackdrop背景
  • ¥70 2048小游戏毕设项目
  • ¥20 mysql架构,按照姓名分表
  • ¥15 MATLAB实现区间[a,b]上的Gauss-Legendre积分
  • ¥15 delphi webbrowser组件网页下拉菜单自动选择问题
  • ¥15 linux驱动,linux应用,多线程